<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Core_Api_Languages extends Core_Api_Abstract {

  public function getLanguages($params = array()) {
  
    $table = Engine_Api::_()->getDbTable('languages', 'core');
    $tableName = $table->info('name');
    
    $select = $table->select()
                    ->from($tableName);
    if(!isset($params['admin']) && empty($params['admin'])) {
      $select->where('enabled = ?', 1);
    }
    $select->order('order ASC');
    
    $languages = $table->fetchAll($select);
    $localeMultiOptions = array();
    foreach ($languages as $language) {
      $localeMultiOptions[$language->code] = $language->name;
    }
    return $localeMultiOptions;
  }
}
