当前位置: 首页>>代码示例>>PHP>>正文


PHP ZLanguage::getLanguageName方法代码示例

本文整理汇总了PHP中ZLanguage::getLanguageName方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::getLanguageName方法的具体用法?PHP ZLanguage::getLanguageName怎么用?PHP ZLanguage::getLanguageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZLanguage的用法示例。


在下文中一共展示了ZLanguage::getLanguageName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setInstalled

 public function setInstalled()
 {
     $installed_languages = \ZLanguage::getInstalledLanguages();
     $installed = [];
     foreach ($installed_languages as $langCode) {
         $installed[$langCode]['name'] = \ZLanguage::getLanguageName($langCode);
         $installed[$langCode]['data'] = new \ZLocale($langCode);
     }
     $this->installed = $installed;
     return;
 }
开发者ID:Kaik,项目名称:ZikulaLanguagesModule,代码行数:11,代码来源:Languages.php

示例2: languageName

 /**
  * @param string $code
  * @return string
  */
 public function languageName($code)
 {
     return \ZLanguage::getLanguageName($code);
 }
开发者ID:Silwereth,项目名称:core,代码行数:8,代码来源:CoreExtension.php

示例3: smarty_modifier_getlanguagename

/**
 * Zikula_View modifier to retrieve a language name from its l2 code
 *
 * Example:
 *   {$language|getlanguagename}
 *
 * @param string $langcode The language to process.
 *
 * @return string The language name.
 */
function smarty_modifier_getlanguagename($langcode)
{
    return ZLanguage::getLanguageName($langcode);
}
开发者ID:planetenkiller,项目名称:core,代码行数:14,代码来源:modifier.getlanguagename.php

示例4: view

 /**
  * View all blocks.
  *
  * @return string HTML output string.
  */
 public function view()
 {
     // Security check
     if (!SecurityUtil::checkPermission('Blocks::', '::', ACCESS_EDIT)) {
         return LogUtil::registerPermissionError();
     }
     $sfilter = SessionUtil::getVar('filter', array(), '/Blocks');
     $filter = FormUtil::getPassedValue('filter', $sfilter);
     $clear = FormUtil::getPassedValue('clear', 0);
     if ($clear) {
         $filter = array();
         SessionUtil::setVar('filter', $filter, '/Blocks');
     }
     // sort and sortdir GET parameters override filter values
     $sort = isset($filter['sort']) && !empty($filter['sort']) ? strtolower($filter['sort']) : 'bid';
     $sortdir = isset($filter['sortdir']) && !empty($filter['sortdir']) ? strtoupper($filter['sortdir']) : 'ASC';
     $filter['sort'] = FormUtil::getPassedValue('sort', $sort, 'GET');
     $filter['sortdir'] = FormUtil::getPassedValue('sortdir', $sortdir, 'GET');
     if ($filter['sortdir'] != 'ASC' && $filter['sortdir'] != 'DESC') {
         $filter['sortdir'] = 'ASC';
     }
     $filter['blockposition_id'] = isset($filter['blockposition_id']) ? $filter['blockposition_id'] : 0;
     $filter['modid'] = isset($filter['modid']) ? $filter['modid'] : 0;
     $filter['language'] = isset($filter['language']) ? $filter['language'] : '';
     $filter['active_status'] = isset($filter['active_status']) ? $filter['active_status'] : 0;
     // generate an authorisation key for the links
     $token = SecurityUtil::generateCsrfToken($this->serviceManager, true);
     // set some default variables
     $rownum = 1;
     $lastpos = '';
     // Get all blocks
     $blocks = ModUtil::apiFunc('Blocks', 'user', 'getall', $filter);
     // we can easily count the number of blocks using count() rather than
     // calling the api function
     $numrows = count($blocks);
     // create an empty arrow to hold the processed items
     $blockitems = array();
     // get all possible block positions
     $blockspositions = ModUtil::apiFunc('Blocks', 'user', 'getallpositions');
     // build assoc array for easier usage later on
     foreach ($blockspositions as $blocksposition) {
         $allbposarray[$blocksposition['pid']] = $blocksposition['name'];
     }
     // loop round each item calculating the additional information
     $blocksitems = array();
     foreach ($blocks as $key => $block) {
         // set the module that holds the block
         $modinfo = ModUtil::getInfo($block['mid']);
         $block['modname'] = $modinfo['displayname'];
         // set the blocks language
         if (empty($block['language'])) {
             $block['language'] = $this->__('All');
         } else {
             $block['language'] = ZLanguage::getLanguageName($block['language']);
         }
         $thisblockspositions = ModUtil::apiFunc('Blocks', 'user', 'getallblockspositions', array('bid' => $block['bid']));
         $bposarray = array();
         foreach ($thisblockspositions as $singleblockposition) {
             $bposarray[] = $allbposarray[$singleblockposition['pid']];
         }
         $block['positions'] = implode(', ', $bposarray);
         unset($bposarray);
         // calculate what options the user has over this block
         $block['options'] = array();
         if ($block['active']) {
             $block['options'][] = array('url' => ModUtil::url('Blocks', 'admin', 'deactivate', array('bid' => $block['bid'], 'csrftoken' => $token)), 'image' => 'folder_grey.png', 'title' => $this->__f('Deactivate \'%s\'', $block['title']), 'noscript' => true);
         } else {
             $block['options'][] = array('url' => ModUtil::url('Blocks', 'admin', 'activate', array('bid' => $block['bid'], 'csrftoken' => $token)), 'image' => 'folder_green.png', 'title' => $this->__f('Activate \'%s\'', $block['title']), 'noscript' => true);
         }
         $block['options'][] = array('url' => ModUtil::url('Blocks', 'admin', 'modify', array('bid' => $block['bid'])), 'image' => 'xedit.png', 'title' => $this->__f('Edit \'%s\'', $block['title']), 'noscript' => false);
         $block['options'][] = array('url' => ModUtil::url('Blocks', 'admin', 'delete', array('bid' => $block['bid'])), 'image' => '14_layer_deletelayer.png', 'title' => $this->__f('Delete \'%s\'', $block['title']), 'noscript' => false);
         $blocksitems[] = $block;
     }
     $this->view->assign('blocks', $blocksitems);
     // get the block positions
     $items = ModUtil::apiFunc('Blocks', 'user', 'getallpositions');
     // Loop through each returned item adding in the options that the user has over the item
     foreach ($items as $key => $item) {
         if (SecurityUtil::checkPermission('Blocks::', "{$item['name']}::", ACCESS_READ)) {
             $options = array();
             if (SecurityUtil::checkPermission('Blocks::', "{$item['name']}::\$", ACCESS_EDIT)) {
                 $options[] = array('url' => ModUtil::url('Blocks', 'admin', 'modifyposition', array('pid' => $item['pid'])), 'image' => 'xedit.png', 'title' => $this->__f('Edit blockposition \'%s\'', $item['name']));
                 if (SecurityUtil::checkPermission('Blocks::', "{$item['name']}::", ACCESS_DELETE)) {
                     $options[] = array('url' => ModUtil::url('Blocks', 'admin', 'deleteposition', array('pid' => $item['pid'])), 'image' => '14_layer_deletelayer.png', 'title' => $this->__f('Delete blockposition \'%s\'', $item['name']));
                 }
             }
             // Add the calculated menu options to the item array
             $items[$key]['options'] = $options;
         }
     }
     // Assign the items to the template
     ksort($items);
     $this->view->assign('positions', $items);
     $this->view->assign('filter', $filter)->assign('sort', $filter['sort'])->assign('sortdir', $filter['sortdir']);
     // Return the output that has been generated by this function
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例5: getAvailableLanguages

    public function getAvailableLanguages($translate)
    {
        $savedLanguage = ZLanguage::getLanguageCode();
        $langlist = ZLanguage::getInstalledLanguages();

        $list = array();
        foreach ($langlist as $code) {
            $img = file_exists("images/flags/flag-$code.png");

            if ($translate == 2) {
                // configuration requires to translate each item in the list into the language of the country being shown
                ZLanguage::setLocale($code);
                $langname = ZLanguage::getLanguageName($code);
                ZLanguage::setLocale($savedLanguage);
            } else {
                $langname = ZLanguage::getLanguageName($code);
            }
            $list[] = array('code' => $code,
                            'name' => $langname,
                            'flag' => $img ? "images/flags/flag-$code.png" : '');
        }

        usort($list, '_blocks_thelangblock_sort');

        return $list;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:26,代码来源:Lang.php

示例6: view

    /**
     * View all blocks.
     *
     * @return string HTML output string.
     */
    public function view()
    {
        // Security check
        if (!SecurityUtil::checkPermission('Blocks::', '::', ACCESS_EDIT)) {
            return LogUtil::registerPermissionError();
        }

        $sfilter = SessionUtil::getVar('filter', array(), '/Blocks');
        $filter = FormUtil::getPassedValue('filter', $sfilter);

        $clear = FormUtil::getPassedValue('clear', 0);
        if ($clear) {
            $filter = array();
            SessionUtil::setVar('filter', $filter, '/Blocks');
        }

        // sort and sortdir GET parameters override filter values
        $sort = (isset($filter['sort']) && !empty($filter['sort'])) ? strtolower($filter['sort']) : 'bid';
        $sortdir = (isset($filter['sortdir']) && !empty($filter['sortdir'])) ? strtoupper($filter['sortdir']) : 'ASC';

        $filter['sort'] = FormUtil::getPassedValue('sort', $sort, 'GET');
        $filter['sortdir'] = FormUtil::getPassedValue('sortdir', $sortdir, 'GET');
        if ($filter['sortdir'] != 'ASC' && $filter['sortdir'] != 'DESC') {
            $filter['sortdir'] = 'ASC';
        }
        $filter['blockposition_id'] = isset($filter['blockposition_id']) ? $filter['blockposition_id'] : 0;
        $filter['module_id'] = isset($filter['module_id']) ? $filter['module_id'] : 0;
        $filter['language'] = isset($filter['language']) ? $filter['language'] : '';
        $filter['active_status'] = isset($filter['active_status']) ? $filter['active_status'] : 0;

        $this->view->assign('filter', $filter)
                   ->assign('sort', $filter['sort'])
                   ->assign('sortdir', $filter['sortdir']);

        // generate an authorisation key for the links
        $csrftoken = SecurityUtil::generateCsrfToken($this->serviceManager, true);
        $this->view->assign('csrftoken', $csrftoken);

        // Get all blocks
        $blocks = ModUtil::apiFunc('Blocks', 'user', 'getall', $filter);

        // get all possible block positions and build assoc array for easier usage later on
        $blockspositions = ModUtil::apiFunc('Blocks', 'user', 'getallpositions');
        foreach ($blockspositions as $blocksposition) {
            $allbposarray[$blocksposition['pid']] = $blocksposition['name'];
        }

        // loop round each item calculating the additional information
        $blocksitems = array();
        foreach ($blocks as $key => $block) {

            $block = $block->toArray();

            // set the module that holds the block
            $modinfo = ModUtil::getInfo($block['mid']);
            $block['modname'] = $modinfo['displayname'];

            // set the block's language
            if (empty($block['language'])) {
                $block['language'] = $this->__('All');
            } else {
                $block['language'] = ZLanguage::getLanguageName($block['language']);
            }

            // set the block's position(s)
            $bposarray = array();
            $thisblockspositions = ModUtil::apiFunc('Blocks', 'user', 'getallblockspositions', array('bid' => $block['bid']));
            foreach ($thisblockspositions as $singleblockposition) {
                $bposarray[] = $allbposarray[$singleblockposition['pid']];
            }
            $block['positions'] = implode(', ', $bposarray);
            unset($bposarray);

            // push block to array
            $blocksitems[] = $block;
        }
        $this->view->assign('blocks', $blocksitems);

        // get the block positions and assign them to the template
        $positions = ModUtil::apiFunc('Blocks', 'user', 'getallpositions');
        $this->view->assign('positions', $positions);

        // Return the output that has been generated by this function
        return $this->view->fetch('blocks_admin_view.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:90,代码来源:Admin.php

示例7: edit

    /**
     * edit the main information of a form
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param:	args   with the form identity
     * @return:	A form necessary to modify the form
     */
    public function edit($args) {
        $fid = FormUtil::getPassedValue('fid', isset($args['fid']) ? $args['fid'] : null, 'POST');
        $aio = FormUtil::getPassedValue('aio', isset($args['aio']) ? $args['aio'] : null, 'POST');
        // Security check
        if (!SecurityUtil::checkPermission('IWforms::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }
        //Get item
        $item = ModUtil::apiFunc('IWforms', 'user', 'getFormDefinition', array('fid' => $fid));
        if ($item == false) {
            LogUtil::registerError($this->__('Could not find form'));
            return System::redirect(ModUtil::url('IWforms', 'admin', 'main'));
        }
        //get all categories
        $categories = ModUtil::apiFunc('IWforms', 'user', 'getAllCategories');
        global $Intraweb;
        $multizk = (isset($GLOBALS['ZConfig']['Multisites']['multi']) && $GLOBALS['ZConfig']['Multisites']['multi'] == 1) ? 1 : 0;

        $filesFolder = ModUtil::getVar('IWmain', 'documentRoot') . '/' . ModUtil::getVar('IWforms', 'attached');

        $languages = ZLanguage::getInstalledLanguages();
        $languagesArray = array();
        foreach ($languages as $lang) {
            $languagesArray[] = array('code' => $lang,
                'name' => ZLanguage::getLanguageName($lang),
            );
        }

        $fields = ModUtil::apiFunc('IWforms', 'user', 'getAllFormFields', array('fid' => $fid));

        return $this->view->assign('cats', $categories)
                        ->assign('aio', $aio)
                        ->assign('item', $item)
                        ->assign('multizk', $multizk)
                        ->assign('filesFolder', $filesFolder)
                        ->assign('new', ModUtil::func('IWforms', 'user', 'makeTimeForm', $item['new']))
                        ->assign('caducity', ModUtil::func('IWforms', 'user', 'makeTimeForm', $item['caducity']))
                        ->assign('languages', $languagesArray)
                        ->assign('fields', $fields)
                        ->fetch('IWforms_admin_form_definitionEdit.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:47,代码来源:Admin.php


注:本文中的ZLanguage::getLanguageName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。