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


PHP ModUtil::func方法代码示例

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


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

示例1: smarty_function_contentcodeeditor

/**
 * Content
 *
 * @copyright (C) 2007-2010, Content Development Team
 * @link http://github.com/zikula-modules/Content
 * @license See license.txt
 */
function smarty_function_contentcodeeditor($params, $view)
{
    $dom = ZLanguage::getModuleDomain('Content');
    $inputId = $params['inputId'];
    $inputType = isset($params['inputType']) ? $params['inputType'] : null;
    // Get reference to optional radio button that enables the editor (a hack for the HTML plugin).
    // It would have been easier just to read a $var in the template, but this won't work with a
    // Forms plugin - you would just get the initial value from when the page was loaded
    $htmlRadioButton = isset($params['htmlradioid']) ? $view->getPluginById($params['htmlradioid']) : null;
    $textRadioButton = isset($params['textradioid']) ? $view->getPluginById($params['textradioid']) : null;
    $html = '';
    $useBBCode = $textRadioButton == null && $inputType == 'text' && !$view->isPostBack() || $textRadioButton != null && $textRadioButton->checked;
    if ($useBBCode && ModUtil::available('BBCode')) {
        $html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
        $html .= ModUtil::func('BBCode', 'User', 'bbcodes', array('textfieldid' => $inputId, 'images' => 0));
        $html .= "</em></div>";
    } else {
        if ($useBBCode && !ModUtil::available('BBCode')) {
            $html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
            $html .= '(' . __("Please install the BBCode module to enable BBCodes display.", $dom) . ')';
            $html .= "</em></div>";
        }
    }
    return $html;
}
开发者ID:robbrandt,项目名称:Content,代码行数:32,代码来源:function.contentcodeeditor.php

示例2: 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->$this->__('Module IWmain is needed. You have to install the IWmain module before installing it.'));
     }
     // Check if the version needed is correct
     $versionNeeded = '3.0.0';
     if (!ModUtil::func('IWmain', 'admin', 'checkVersion', array('version' => $versionNeeded))) {
         return false;
     }
     // Create module table
     if (!DBUtil::createTable('IWusers'))
         return false;
     if (!DBUtil::createTable('IWusers_friends'))
         return false;
     // Create the index
     if (!DBUtil::createIndex('iw_uid', 'IWusers', 'uid'))
         return false;
     if (!DBUtil::createIndex('iw_uid', 'IWusers_friends', 'uid'))
         return false;
     if (!DBUtil::createIndex('iw_fid', 'IWusers_friends', 'fid'))
         return false;
     //Create module vars
     $this->setVar('friendsSystemAvailable', 1)
             ->setVar('invisibleGroupsInList', '$')
             ->setVar('usersCanManageName', 0)
             ->setVar('allowUserChangeAvatar', '1')
             ->setVar('allowUserSetTheirSex', '0')
             ->setVar('allowUserDescribeTheirSelves', '1')
             ->setVar('avatarChangeValidationNeeded', '1')
             ->setVar('usersPictureFolder', 'photos');
     return true;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:35,代码来源:Installer.php

示例3: displayEditing

 public function displayEditing()
 {
     if (!empty($this->addressid)) {
         return ModUtil::func('AddressBook', 'user', 'simpledisplay', array('id' => (int) $this->addressid));
     }
     return $this->__('No address selected');
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:7,代码来源:Address.php

示例4: updateUsedSpace

    /**
     * update the used disk for the user
     * @author:    Albert Pérez Monfort
     * @return:    True if success and false otherwise
    */
    public function updateUsedSpace()
    {
        // security check
        if (!SecurityUtil::checkPermission( 'Files::', '::', ACCESS_ADD)) {
            return LogUtil::registerPermissionError();
        }
        // get user used space
        $usedSpace = ModUtil::apiFunc('Files', 'user', 'get');
        if(!$usedSpace){
            // user row doesn't exists and it is created
            ModUtil::apiFunc('Files', 'user', 'createUserFilesInfo');
        }

        $check = ModUtil::func('Files', 'user', 'checkingModule');
        if ($check['status'] != 'ok') {
	    $this->view->assign('check', $check);
            return $this->view->fetch('Files_user_failedConf.tpl');
        }
        $initFolderPath = $check['initFolderPath'];
        $spaceUsed = ModUtil::apiFunc('Files', 'user', 'calcUsedSpace', array('folderToCalc' => $initFolderPath));
        $item = array('diskUse' => DataUtil::formatForStore($spaceUsed));
        $pntable =& DBUtil::getTables();
        $c = $pntable['Files_column'];
        $where = "$c[userId]=" . UserUtil::getVar('uid');
        if (!DBUtil::updateObject($item, 'Files', $where, 'fileId')) {
            return LogUtil::registerError ($this->__('Error! Could not update the used disk.'));
        }
        // Let the calling process know that we have finished successfully
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:35,代码来源:User.php

示例5: handler

 /**
  * Handles an error.
  *
  * @param integer $errno      Number of the error.
  * @param string  $errstr     Error message.
  * @param string  $errfile    Filename where the error occurred.
  * @param integer $errline    Line of the error.
  * @param string  $errcontext Context of the error.
  *
  * @return boolean
  */
 public function handler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = null)
 {
     $this->setupHandler($errno, $errstr, $errfile, $errline, $errcontext);
     // Notify all loggers
     $this->eventManager->notify($this->event->setArgs(array('trace' => $this->trace, 'type' => $this->type, 'errno' => $this->errno, 'errstr' => $this->errstr, 'errfile' => $this->errfile, 'errline' => $this->errline, 'errcontext' => $this->errcontext)));
     if ($this->isPHPError() && System::isDevelopmentMode() && $this->showPHPErrorHandler()) {
         // allow PHP to return error
         $this->resetHandler();
         return false;
     }
     if (!$this->isDisplayErrorTemplate()) {
         // prevent PHP from handling the event after we return
         $this->resetHandler();
         return true;
     }
     // obey reporing level
     if (abs($this->getType()) > $this->serviceManager['log.display_level']) {
         return false;
     }
     // unless in development mode, exit.
     if (!$this->serviceManager['log.display_template']) {
         return false;
     }
     // if we get this far, display template
     echo ModUtil::func('Errors', 'user', 'system', array('type' => $this->errno, 'message' => $this->errstr, 'file' => $this->errfile, 'line' => $this->errline));
     Zikula_View_Theme::getInstance()->themefooter();
     System::shutDown();
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:39,代码来源:Standard.php

示例6: 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

示例7: 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

示例8: main

 /**
  * Give access to the administrator main page
  * @author:    Albert Pérez Monfort (aperezm@xtec.cat)
  * @return:    The form for general configuration values of the Intraweb modules
  */
 public function main()
 {
     // Security check
     if (!SecurityUtil::checkPermission('Files::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $multisites = isset($GLOBALS['PNConfig']['Multisites']['multi']) && $GLOBALS['PNConfig']['Multisites']['multi'] == 1 ? true : false;
     if ($multisites) {
         $siteDNS = FormUtil::getPassedValue('siteDNS', '', 'GET');
         $folderPath = $GLOBALS['PNConfig']['Multisites']['filesRealPath'] . '/' . $siteDNS . $GLOBALS['PNConfig']['Multisites']['siteFilesFolder'];
     } else {
         $folderPath = ModUtil::getVar('Files', 'folderPath');
     }
     $moduleVars = array('usersFolder' => ModUtil::getVar('Files', 'usersFolder'), 'allowedExtensions' => ModUtil::getVar('Files', 'allowedExtensions'), 'defaultQuota' => ModUtil::getVar('Files', 'defaultQuota'), 'filesMaxSize' => ModUtil::getVar('Files', 'filesMaxSize'), 'maxWidth' => ModUtil::getVar('Files', 'maxWidth'), 'maxHeight' => ModUtil::getVar('Files', 'maxHeight'), 'showHideFiles' => ModUtil::getVar('Files', 'showHideFiles'), 'editableExtensions' => ModUtil::getVar('Files', 'editableExtensions'));
     // check if file file.php exists in folder modules/Files
     $fileFileInModule = file_exists('modules/Files/file.php') ? true : false;
     // check if file file.php exists in folder modules/Files
     $fileFileNotInRoot = !file_exists('file.php') ? true : false;
     $folderPathProblem = !is_writable($folderPath) || !file_exists($folderPath) ? true : false;
     $usersFolderProblem = !is_writable($folderPath . '/' . $moduleVars['usersFolder']) || !file_exists($folderPath . '/' . $moduleVars['usersFolder']) || $moduleVars['usersFolder'] == '' ? true : false;
     $quotasTable = ModUtil::func('Files', 'admin', 'getQuotasTable');
     $this->view->assign('folderPath', $folderPath);
     $this->view->assign('multisites', $multisites);
     $this->view->assign('quotasTable', $quotasTable);
     $this->view->assign('moduleVars', $moduleVars);
     $this->view->assign('fileFileInModule', $fileFileInModule);
     $this->view->assign('fileFileNotInRoot', $fileFileNotInRoot);
     $this->view->assign('folderPathProblem', $folderPathProblem);
     $this->view->assign('usersFolderProblem', $usersFolderProblem);
     return $this->view->fetch('Files_admin_conf.htm');
 }
开发者ID:hardtoneselector,项目名称:Files,代码行数:36,代码来源:Admin.php

示例9: smarty_function_login_form_fields

/**
 * Copyright Zikula Foundation 2011 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula_View
 * @subpackage Template_Plugins
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
function smarty_function_login_form_fields($params, $view)
{
    if (!isset($params) || !is_array($params) || empty($params)) {
        throw new \Zikula\Framework\Exception\FatalException(__f('An invalid \'%1$s\' parameter was received by the template function \'%2$s\'.', array('$params', 'login_form_fields'), 'Zikula'));
    }
    if (isset($params['authentication_method']) && is_array($params['authentication_method']) && !empty($params['authentication_method']) && count($params['authentication_method']) == 2) {
        $authenticationMethod = $params['authentication_method'];
        if (!isset($authenticationMethod['modname']) || empty($authenticationMethod['modname']) || !is_string($authenticationMethod['modname'])) {
            throw new \Zikula\Framework\Exception\FatalException(__f('An invalid authentication module was received by the template function \'%1$s\'.', array('login_form_fields'), 'Zikula'));
        }
        if (!isset($authenticationMethod['method']) || empty($authenticationMethod['method']) || !is_string($authenticationMethod['method'])) {
            throw new \Zikula\Framework\Exception\FatalException(__f('An invalid authentication method was received by the template function \'%1$s\'.', array('login_form_fields'), 'Zikula'));
        }
    } else {
        throw new \Zikula\Framework\Exception\FatalException(__f('An invalid \'%1$s\' parameter was received by the template function \'%2$s\'.', array('authentication_method', 'login_form_fields'), 'Zikula'));
    }
    if (isset($params['form_type']) && is_string($params['form_type']) && !empty($params['form_type'])) {
        $formType = $params['form_type'];
    } else {
        throw new \Zikula\Framework\Exception\FatalException(__f('An invalid \'%1$s\' parameter was received by the template function \'%2$s\'.', array('form_type', 'login_form_fields'), 'Zikula'));
    }
    if (isset($params['assign'])) {
        if (!is_string($params['assign']) || empty($params['assign'])) {
            throw new \Zikula\Framework\Exception\FatalException(__f('An invalid \'%1$s\' parameter was received by the template function \'%2$s\'.', array('assign', 'login_form_fields'), 'Zikula'));
        }
    }
    $args = array('form_type' => $formType, 'method' => $authenticationMethod['method']);
    $content = ModUtil::func($authenticationMethod['modname'], 'Authentication', 'getLoginFormFields', $args, 'Zikula_Controller_AbstractAuthentication');
    $content = $content->getContent();
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $content);
    } else {
        return $content;
    }
}
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:48,代码来源:function.login_form_fields.php

示例10: install

    public function install() {
        if (!SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }
        // Checks if module IWmain is installed. If not returns error
        if (!ModUtil::available('IWmain')) {
            return LogUtil::registerError(__('Module IWmain is required. You have to install the IWmain module previously to install it.'));
        }

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

        if (!DBUtil::createTable('IWdocmanager'))
            return false;
        if (!DBUtil::createTable('IWdocmanager_categories'))
            return false;

        //Create indexes
        $table = DBUtil::getTables();
        $c = $table['IWdocmanager_column'];
        DBUtil::createIndex($c['author'], 'IWdocmanager', 'author');
        DBUtil::createIndex($c['categoryId'], 'IWdocmanager', 'categoryId');

        //Create module vars
        $this->setVar('documentsFolder', 'documents')
                ->setVar('notifyMail', '')
                ->setVar('editTime', '45')
                ->setVar('deleteTime', '20');

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

示例11: get_sense_grup

    public function get_sense_grup() {

        $users = DBUtil::selectObjectArray('users', '', '', -1, -1, 'uid');
        // Check for a DB error
        if ($users === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }
        // get all users that are in any group
        $allUsersWithGroup = DBUtil::selectObjectArray('group_membership', '', '', -1, -1, 'uid');
        if ($allUsersWithGroup === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }
        $diff = array_diff_key($users, $allUsersWithGroup);
        $usersList = '$$';
        $registres = array();
        if (count($diff) > 0) {
            foreach ($diff as $user) {
                $usersList .= $user['uid'] . '$$';
            }
            //get all users information
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $usersInfo = ModUtil::func('IWmain', 'user', 'getAllUsersInfo', array('sv' => $sv,
                        'list' => $usersList,
                        'info' => 'ccn'));
            foreach ($usersInfo as $key => $value) {
                $registres[] = array('name' => $value,
                    'id' => $key);
            }
        }
        return $registres;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:User.php

示例12: getFile

    public function getFile($args) {
        // File name with the path
        $fileName = FormUtil::getPassedValue('fileName', isset($args['fileName']) ? $args['fileName'] : 0, 'GET');

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        return ModUtil::func('IWmain', 'user', 'getFile', array('fileName' => $fileName,
                    'sv' => $sv));
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:8,代码来源:User.php

示例13: IWqv_qvsummaryblock_display

/**
 * Gets qv summary information
 *
 * @author: Sara Arjona Téllez (sarjona@xtec.cat)
 */
function IWqv_qvsummaryblock_display($row) {
    // Security check
    if (!SecurityUtil::checkPermission('IWqv:summaryBlock:', $row['title'] . "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
        return false;
    }

    $uid = UserUtil::getVar('uid');
    if (!isset($uid))
        $uid = '-1';

    // Get the qvsummary saved in the user vars. It is renovate every 10 minutes
    $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
    $exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'qvsummary',
                'module' => 'IWqv',
                'uid' => $uid,
                'sv' => $sv));
    if ($exists) {
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $s = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid,
                    'name' => 'qvsummary',
                    'module' => 'IWqv',
                    'sv' => $sv,
                    'nult' => true));
    } else {
        $teacherassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("teacher" => $uid));
        $studentassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("student" => $uid));

        if (empty($teacherassignments) && empty($studentassignments)) {
            
        }

        $view = Zikula_View::getInstance('IWqv', false);
        $view->assign('teacherassignments', $teacherassignments);
        $view->assign('studentassignments', $studentassignments);
        $view->assign('isblock', true);
        $s = $view->fetch('IWqv_block_summary.htm');

        if (empty($teacherassignments) && empty($studentassignments)) {
            $s = '';
        }

        //Copy the block information into user vars
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $uid,
            'name' => 'qvsummary',
            'module' => 'IWqv',
            'sv' => $sv,
            'value' => $s,
            'lifetime' => '2000'));
    }

    if ($s == '') {
        return false;
    }

    $row['content'] = $s;
    return BlockUtil::themesideblock($row);
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:63,代码来源:Qvsummary.php

示例14: display

    /**
     * Gets topics information
     *
     * @author		Albert Pérez Monfort (aperezm@xtec.cat)
     * @author 		Josep Ferràndiz Farré (jferran6@xtec.cat)
     */
    public function display($row) {
        // Security check
        if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN)) {
            return false;
        }

        $uid = UserUtil::getVar('uid');

        //Check if user belongs to change group. If not the block is not showed
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $isMember = ModUtil::func('IWmain', 'user', 'isMember',
                                   array('sv' => $sv,
                                         'gid' => ModUtil::getVar('IWmyrole', 'rolegroup'),
                                         'uid' => $uid));

        if (!$isMember) {
            return false;
        }

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $uidGroups = ModUtil::func('IWmain', 'user', 'getAllUserGroups',
                                    array('sv' => $sv,
                                          'uid' => $uid));
        foreach ($uidGroups as $g) {
            $originalGroups[$g['id']] = 1;
        }

        $view = Zikula_View::getInstance('IWmyrole', false);

        // Gets the groups
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $allGroups = ModUtil::func('IWmain', 'user', 'getAllGroups',
                                    array('sv' => $sv,
                                          'less' => ModUtil::getVar('IWmyrole', 'rolegroup')));

        $groupsNotChangeable = ModUtil::getVar('IWmyrole', 'groupsNotChangeable');

        foreach ($allGroups as $group) {
            if (strpos($groupsNotChangeable, '$' . $group['id'] . '$') == false) $groupsArray[] = $group;
        }

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $invalidChange = ModUtil::func('IWmain', 'user', 'userGetVar',
                                        array('uid' => $uid,
                                              'name' => 'invalidChange',
                                              'module' => 'IWmyrole',
                                              'nult' => true,
                                              'sv' => $sv));

        $view->assign('groups', $groupsArray);
        $view->assign('invalidChange', $invalidChange);
        $view->assign('roleGroups', $originalGroups);
        $s = $view->fetch('IWmyrole_block_change.htm');

        $row['content'] = $s;
        return BlockUtil::themesideblock($row);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:63,代码来源:Myrole.php

示例15: install

    /**
     * Initialise the IWmyrole module creating module vars
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Josep Ferràndiz Farré (jferran6@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    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 required. You have to install the IWmain module previously to install it.'));
        }

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

        // Name of the initial group
        $name = "changingRole";

        // The API function is called.
        $check = ModUtil::apiFunc('Groups', 'admin', 'getgidbyname', array('name' => $name));

        if ($check != false) {
            // Group already exists
            // LogUtil::registerError (_GROUPS_ALREADYEXISTS);
            $gid = $check;
        } else {
            // Falta mirar si existeix
            $gid = ModUtil::apiFunc('Groups', 'admin', 'create', array('name' => $name,
                        'gtype' => 0,
                        'state' => 0,
                        'nbumax' => 0,
                        'description' => $this->__('Initial group of users that can change the role')));
            // Success
        }

        // The return value of the function is checked here
        if ($gid != false) {
            $this->setVar('rolegroup', $gid);
            // Gets the first sequence number of permissions list
            $pos = DBUtil::selectFieldMax('group_perms', 'sequence', 'MIN');
            // SET MODULE AND BLOCK PERMISSIONS
            // insert permission myrole:: :: administration in second place
            ModUtil::apiFunc('permissions', 'admin', 'create', array('realm' => 0,
                'id' => $gid,
                'component' => 'IWmyrole::',
                'instance' => '::',
                'level' => '800',
                'insseq' => $pos + 1));
        }

        $this->setVar('groupsNotChangeable', '');

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


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