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


PHP ModUtil类代码示例

本文整理汇总了PHP中ModUtil的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil类的具体用法?PHP ModUtil怎么用?PHP ModUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: preSave

 /**
  * Sets the value of the Registry Relation.
  *
  * @param Doctrine_Event $event Event.
  *
  * @return void
  */
 public function preSave($event)
 {
     $subclasses = ModUtil::getVar('Categories', 'EntityCategorySubclasses', array());
     // get the registry object
     $registry = Doctrine::getTable('Zikula_Doctrine_Model_Registry')->findOneByModuleAndTableAndProperty($subclasses[get_class($this)]['module'], $subclasses[get_class($this)]['table'], $this->reg_property);
     $this['Registry'] = $registry;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:14,代码来源:EntityCategory.php

示例2: handleCommand

 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('Scribite', 'admin', 'main');
         return $view->redirect($url);
     } else {
         if ($args['commandName'] == 'restore') {
             $classname = 'ModulePlugin_Scribite_' . $this->editor . '_Plugin';
             if (method_exists($classname, 'getDefaults')) {
                 $defaults = $classname::getDefaults();
                 if (!empty($defaults)) {
                     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $defaults);
                     LogUtil::registerStatus('Defaults succesfully restored.');
                 }
             }
             return true;
         }
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $data = $view->getValues();
     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $data);
     LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     return true;
 }
开发者ID:pheski,项目名称:Scribite,代码行数:27,代码来源:ModifyEditor.php

示例3: smarty_function_admincategorymenu

/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $view        Reference to the Zikula_View object
 * @return       string      the results of the module function
 */
function smarty_function_admincategorymenu($params, $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
开发者ID:planetenkiller,项目名称:core,代码行数:19,代码来源:function.admincategorymenu.php

示例4: moduleSearch

 /**
  *
  */
 public function moduleSearch($args)
 {
     $dom = ZLanguage::getModuleDomain('MUBoard');
     $searchsubmit = $this->request->getPost()->filter('searchsubmit', 'none', FILTER_SANITIZE_STRING);
     $searchoptions = $this->request->getPost()->filter('searchoptions', 'all', FILTER_SANITIZE_STRING);
     $searchplace = $this->request->getPost()->filter('searchplace', 'title', FILTER_SANITIZE_STRING);
     $resultorder = $this->request->getPost()->filter('resultorder', 'none', FILTER_SANITIZE_STRING);
     $kind = $this->request->query->filter('kind', 'none', FILTER_SANITIZE_STRING);
     // user has not entered a string and there is 'none' as kind of search
     if ($searchsubmit == 'none' && $kind == 'none') {
         // return search form template
         return $this->searchRedirect();
     } else {
         if ($searchsubmit != 'none' && $kind == 'none') {
             $searchstring = $this->request->getPost()->filter('searchstring', '', FILTER_SANITIZE_STRING);
             if ($searchstring == '') {
                 $url = ModUtil::url($this->name, 'search', 'modulesearch');
                 return LogUtil::registerError(__('You have to enter a string!', $dom), null, $url);
             } else {
                 $args['searchstring'] = $searchstring;
                 $args['searchoptions'] = $searchoptions;
                 $args['searchplace'] = $searchplace;
                 $args['resultorder'] = $resultorder;
                 $args['kind'] = $kind;
             }
         }
         if ($searchsubmit == 'none' && $kind != 'none') {
             $args['kind'] = $kind;
         }
     }
     return ModUtil::apiFunc($this->name, 'search', 'moduleSearch', $args);
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:35,代码来源:Search.php

示例5: Install

    public function Install() {
        // Checks if module IWmain is installed. If not returns error
        $modid = ModUtil::getIdFromName('IWmain');
        $modinfo = ModUtil::getInfo($modid);

        if ($modinfo['state'] != 3) {
            return LogUtil::registerError($this->__('Module IWmain is needed. You have to install the IWmain module before installing it.'));
        }

        // Check if the version needed is correct
        $versionNeeded = '2.0';
        if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
            return false;
        }

        // create module tables
        $tables = array('IWstats', 'IWstats_summary');
        foreach ($tables as $table) {
            if (!DBUtil::createTable($table)) {
                return false;
            }
        }

        // create several indexes for IWstats table
        $table = DBUtil::getTables();
        $c = $table['IWstats_column'];
        if (!DBUtil::createIndex($c['moduleid'], 'IWstats', 'moduleid')) {
            return false;
        }
        if (!DBUtil::createIndex($c['uid'], 'IWstats', 'uid')) {
            return false;
        }
        if (!DBUtil::createIndex($c['ip'], 'IWstats', 'ip')) {
            return false;
        }
        if (!DBUtil::createIndex($c['ipForward'], 'IWstats', 'ipForward')) {
            return false;
        }
        if (!DBUtil::createIndex($c['ipClient'], 'IWstats', 'ipClient')) {
            return false;
        }
        if (!DBUtil::createIndex($c['userAgent'], 'IWstats', 'userAgent')) {
            return false;
        }
        if (!DBUtil::createIndex($c['isadmin'], 'IWstats', 'isadmin')) {
            return false;
        }

        // Set up config variables
        $this->setVar('skippedIps', '')
                ->setVar('modulesSkipped', '')
                ->setVar('deleteFromDays', 90)
                ->setVar('keepDays', 90);

        // create the system init hook
        EventUtil::registerPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit'));

        // Initialisation successful
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:60,代码来源:Installer.php

示例6: getlinks

 /**
  * get available Admin panel links
  *
  * @return array Array of admin links
  */
 public function getlinks()
 {
     $links = array();
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_READ)) {
         $links[] = array('url' => ModUtil::url($this->name, 'user', 'main'), 'text' => $this->__('Frontend'), 'title' => $this->__('Switch to user area.'), 'class' => 'z-icon-es-home');
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'category')), 'text' => $this->__('Categories'), 'title' => $this->__('Category list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'forum')), 'text' => $this->__('Forums'), 'title' => $this->__('Forum list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'posting')), 'text' => $this->__('Postings'), 'title' => $this->__('Posting list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'abo')), 'text' => $this->__('Abos'), 'title' => $this->__('Abo list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'user')), 'text' => $this->__('Users'), 'title' => $this->__('User list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'rank')), 'text' => $this->__('Ranks'), 'title' => $this->__('Rank list'));
     }
     if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
         $links[] = array('url' => ModUtil::url($this->name, 'admin', 'config'), 'text' => $this->__('Configuration'), 'title' => $this->__('Manage settings for this application'));
     }
     return $links;
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:34,代码来源:Admin.php

示例7: handleCommand

    public function handleCommand(Zikula_Form_View $view, &$args)
    {
        if ($args['commandName'] == 'save') {
            if (!$this->view->isValid()) {
                return false;
            }

            $data = $this->view->getValues();

            if (!ModUtil::setVars('Content', $data['config'])) {
                return $this->view->setErrorMsg($this->__('Failed to set configuration variables'));
            }
            if ($data['config']['categoryUsage'] < 4) {
                // load the category registry util
                $mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $data['config']['categoryPropPrimary']);
                if (!$mainCategory) {
                    return LogUtil::registerError($this->__('Main category property does not exist.'));
                }
                if ($data['config']['categoryUsage'] < 3) {
                    $secondCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $data['config']['categoryPropSecondary']);
                    if (!$secondCategory) {
                        return LogUtil::registerError($this->__('Second category property does not exist.'));
                    }
                }
            }
            LogUtil::registerStatus($this->__('Done! Saved module configuration.'));
        } else if ($args['commandName'] == 'cancel') {
        }

        $url = ModUtil::url('Content', 'admin', 'main');

        return $this->view->redirect($url);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:33,代码来源:Settings.php

示例8: getlinks

 public function getlinks($args)
 {
     $links = array();
     $sublinks = array();
     $links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modules'), 'text' => $this->__('Module list'), 'class' => 'z-icon-es-view');
     $links[] = array('url' => ModUtil::url('Scribite', 'admin', 'newmodule'), 'text' => $this->__('Add module'), 'class' => 'z-icon-es-new');
     $links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modifyconfig'), 'text' => $this->__('Settings'), 'class' => 'z-icon-es-config');
     // check for all supported editors and generate links
     if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'xinha'))) {
         $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyxinha'), 'text' => $this->__('Xinha'));
     }
     if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'ckeditor'))) {
         $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyckeditor'), 'text' => $this->__('CKEditor'));
     }
     // openwysiwyg deprecated @4.3.0
     //        if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'openwysiwyg'))) {
     //            $sublinks[] = array(
     //                'url' => ModUtil::url('scribite', 'admin', 'modifyopenwysiwyg'),
     //                'text' => $this->__('openWYSIWYG'));
     //        }
     if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'nicedit'))) {
         $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifynicedit'), 'text' => $this->__('NicEdit'));
     }
     if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'markitup'))) {
         $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifymarkitup'), 'text' => $this->__('markitup'));
     }
     if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'tinymce'))) {
         $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifytinymce'), 'text' => $this->__('TinyMCE'));
     }
     // add YUI page
     $sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyyui'), 'text' => $this->__('YUI Editor'));
     $links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modules'), 'text' => $this->__('Editor Config'), 'class' => 'z-icon-es-editor', 'links' => $sublinks);
     // return output
     return $links;
 }
开发者ID:rmaiwald,项目名称:Scribite,代码行数:35,代码来源:Admin.php

示例9: install

    /**
    * Initialise SiriusXtecAuth module.
    */
    public function install()
    {
        // create module vars
        // ldap configuration
        $this->setVars(array('ldap_server'  => 'host.domain',
                             'ldap_basedn'  => 'cn=users,dc=host,dc=domain',
                             'ldap_searchattr' => 'cn'));
        // module configutation
        $defaultGroupId = ModUtil::getVar('Groups', 'defaultgroup');
        $initGroups = array($defaultGroupId);
        $this->setVars(array('ldap_active' => false,
                             'users_creation' => false,
                             'new_users_activation' => false,
                             'new_users_groups' => $initGroups,
                             'iw_write' => false,
                             'iw_lastnames' => false,
                             'loginXtecApps' => false,
                             'logoutXtecApps' => false,
                             'gtafProtocol' => 'http',
                             'e13Protocol' => 'http',
                             'gtafURL' => 'aplitic.xtec.cat/pls/gafoas/pk_for_mod_menu.p_for_opcions_menu?p_perfil=RES',
                             'e13URL' => 'aplitic.xtec.cat/pls/e13_formacio_gaf/formacio_gaf.inici',
							 'loginTime' => 200,
							 'logoutTime' => 200));
        // register handler
        EventUtil::registerPersistentModuleHandler('SiriusXtecAuth', 'module.users.ui.login.failed', array('SiriusXtecAuth_Listeners', 'trySiriusXtecAuth'));
        EventUtil::registerPersistentModuleHandler('SiriusXtecAuth', 'module.users.ui.logout.succeeded', array('SiriusXtecAuth_Listeners', 'logoutXtecApps'));
        // finish
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:33,代码来源:Installer.php

示例10: edit

 /**
  * Create or edit record.
  *
  * @return string|boolean Output.
  */
 public function edit()
 {
     if (!SecurityUtil::checkPermission('ExampleDoctrine::', '::', ACCESS_ADD)) {
         return LogUtil::registerPermissionError(ModUtil::url('ExampleDoctrine', 'user', 'index'));
     }
     $id = $this->request->query->getInt('id');
     if ($id) {
         // load user with id
         $user = $this->entityManager->find('ExampleDoctrine_Entity_User', $id);
         if (!$user) {
             return LogUtil::registerError($this->__f('User with id %s not found', $id));
         }
     } else {
         $user = new ExampleDoctrine_Entity_User();
     }
     /* @var $form Symfony\Component\Form\Form */
     $form = $this->serviceManager->getService('symfony.formfactory')->create(new ExampleDoctrine_Form_UserType(), $user);
     if ($this->request->getMethod() == 'POST') {
         $form->bindRequest($this->request);
         if ($form->isValid()) {
             $data = $form->getData();
             $this->entityManager->persist($data);
             $this->entityManager->flush();
             return $this->redirect(ModUtil::url('ExampleDoctrine', 'user', 'view'));
         }
     }
     return $this->view->assign('form', $form->createView())->fetch('exampledoctrine_user_edit.tpl');
 }
开发者ID:planetenkiller,项目名称:core,代码行数:33,代码来源:User.php

示例11: setstatus

 /**
  * This function sets active/inactive status.
  *
  * @param eid
  *
  * @return mixed true or Ajax error
  */
 public function setstatus()
 {
     $this->checkAjaxToken();
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_ADMIN));
     $eid = $this->request->request->get('eid', 0);
     $status = $this->request->request->get('status', 0);
     $alert = '';
     if ($eid == 0) {
         $alert .= $this->__('No ID passed.');
     } else {
         $item = array('eid' => $eid, 'status' => $status);
         $res = DBUtil::updateObject($item, 'ephem', '', 'eid');
         if (!$res) {
             $alert .= $item['eid'] . ', ' . $this->__f('Could not change item, ID %s.', DataUtil::formatForDisplay($eid));
             if ($item['status']) {
                 $item['status'] = 0;
             } else {
                 $item['status'] = 1;
             }
         }
     }
     // get current status to return
     $item = ModUtil::apiFunc($this->name, 'user', 'get', array('eid' => $eid));
     if (!$item) {
         $alert .= $this->__f('Could not get data, ID %s.', DataUtil::formatForDisplay($eid));
     }
     return new Zikula_Response_Ajax(array('eid' => $eid, 'status' => $item['status'], 'alert' => $alert));
 }
开发者ID:nmpetkov,项目名称:Ephemerides,代码行数:35,代码来源:Ajax.php

示例12: getContent

 public function getContent($args)
 {
     switch ($args['pluginid']) {
         case 1:
             //$uid = $args['uid'];
             // Get matching news stories published since last newsletter
             // No selection on categories made !!
             $items = ModUtil::apiFunc('News', 'user', 'getall',
                             array('numitems' => $this->getVar('itemsperpage'),
                                 'status' => 0,
                                 'from' => DateUtil::getDatetime($args['last']),
                                 'filterbydate' => true));
             if ($items != false) {
                 if ($args['contenttype'] == 't') {
                     $counter = 0;
                     $output.="\n";
                     foreach ($items as $item) {
                         $counter++;
                         $output .= $counter . '. ' . $item['title'] . " (" . $this->__f('by %1$s on %2$s', array($item['contributor'], DateUtil::formatDatetime($item['from'], 'datebrief'))) . ")\n";
                     }
                 } else {
                     $render = Zikula_View::getInstance('News');
                     $render->assign('readperm', SecurityUtil::checkPermission('News::', "::", ACCESS_READ));
                     $render->assign('articles', $items);
                     $output = $render->fetch('mailz/listarticles.tpl');
                 }
             } else {
                 $output = $this->__f('No News publisher articles since last newsletter on %s.', DateUtil::formatDatetime($args['last'], 'datebrief')) . "\n";
             }
             return $output;
     }
     return '';
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:33,代码来源:Mailz.php

示例13: smarty_function_nextpostlink

/**
 * Smarty function to display a link to the next post
 *
 * Example
 * <!--[nextpostlink sid=$info.sid layout='%link% <span class="news_metanav">&raquo;</span>']-->
 *
 * @author Mark West
 * @since 20/10/03
 * @see function.nextpostlink.php::smarty_function_nextpostlink()
 * @param array $params All attributes passed to this function from the template
 * @param object &$smarty Reference to the Smarty object
 * @param integer $sid article id
 * @param string $layout HTML string in which to insert link
 * @return string the results of the module function
 */
function smarty_function_nextpostlink($params, &$smarty)
{
    if (!isset($params['sid'])) {
        // get the info template var
        $info = $smarty->get_template_vars('info');
        $params['sid'] = $info['sid'];
    }

    if (!isset($params['layout'])) {
        $params['layout'] = '%link% <span class="news_metanav">&raquo;</span>';
    }

    $article = ModUtil::apiFunc('News', 'user', 'getall',
                            array('query' => array(array('sid', '>', $params[sid])),
                                  'orderdir' => 'ASC',
                                  'numitems' => 1));

    if (!$article) {
        return;
    }

    $articlelink = '<a href="'.DataUtil::formatForDisplay(ModUtil::url('News', 'user', 'display', array('sid' => $article[0]['sid']))).'">'.DataUtil::formatForDisplay($article[0]['title']).'</a>';
    $articlelink = str_replace('%link%', $articlelink, $params['layout']);

    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $articlelink);
    } else {
        return $articlelink;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:45,代码来源:function.nextpostlink.php

示例14: moduleInstall

    /**
     * Handle module install event "installer.module.installed".
     * Receives $modinfo as $args
     *
     * @param Zikula_Event $event
     *
     * @return void
     */
    public static function moduleInstall(Zikula_Event $event)
    {
        $mod = $event['name'];

        // determine search capability
        if (ModUtil::apiFunc($mod, 'search', 'info')) {

            // get all search blocks
            $blocks = BlockUtil::getBlocksInfo();

            foreach ($blocks as $block) {

                $block = $block->toArray();

                if ($block['bkey'] != 'Search') {
                    continue;
                }

                $content = BlockUtil::varsFromContent($block['content']);

                if (!isset($content['active'])) {
                    $content['active'] = array();
                }
                $content['active'][$mod] = 1;

                $block['content'] = BlockUtil::varsToContent($content);
                ModUtil::apiFunc('Blocks', 'admin', 'update', $block);
            }
        }
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:38,代码来源:EventHandlers.php

示例15: display

    public function display($blockinfo) {
        // Security check (1)
        if (!SecurityUtil::checkPermission('IWmenu:topblock:', "$blockinfo[title]::", ACCESS_READ)) {
            return false;
        }

        // Check if the module is available. (2)
        if (!ModUtil::available('IWmenu')) {
            return false;
        }

        // Get variables from content block (3)
        //Get cached user menu
        $uid = is_null(UserUtil::getVar('uid')) ? '-1' : UserUtil::getVar('uid');

        //Generate menu
        $menu_estructure = ModUtil::apiFunc('IWmenu', 'user', 'getMenuStructure');
        // Defaults (4)
        if (empty($menu_estructure)) {
            return false;
        }

        // Create output object (6)
        $view = Zikula_View::getInstance('IWmenu');

        // assign your data to to the template (7)
        $view->assign('menu', $menu_estructure);

        // Populate block info and pass to theme (8)
        $menu = $view->fetch('IWmenu_block_top.htm');

        //$blockinfo['content'] = $menu;
        //return BlockUtil::themesideblock($blockinfo);
        return $menu;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:35,代码来源:Top.php


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