當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ModUtil::Func方法代碼示例

本文整理匯總了PHP中ModUtil::Func方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModUtil::Func方法的具體用法?PHP ModUtil::Func怎麽用?PHP ModUtil::Func使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ModUtil的用法示例。


在下文中一共展示了ModUtil::Func方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getlinks

    public function getlinks($args) {
        $categoryId = FormUtil::getPassedValue('categoryId', isset($args['categoryId']) ? $args['categoryId'] : 0, 'GET');
        $links = array();
        if (SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_READ)) {
            $links[] = array('url' => ModUtil::url($this->name, 'user', 'viewDocs'), 'text' => $this->__('View documents'), 'class' => 'z-icon-es-view');
        }
        $categories = ModUtil::Func($this->name, 'user', 'getUserCategories', array('accessType' => 'add'));

        if (!empty($categories)) {
            // check if user can access to this category
            if (!ModUtil::func($this->name, 'user', 'canAccessCategory', array('categoryId' => $categoryId,
                        'accessType' => 'add',
                    )))
                $categoryId = '';
            $links[] = array('url' => ModUtil::url($this->name, 'user', 'newDoc', array('categoryId' => $categoryId)), 'text' => $this->__('New document'), 'class' => 'z-icon-es-new');
        }
        if (SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_ADMIN)) {
            $links[] = array('url' => ModUtil::url($this->name, 'admin', 'main'), 'text' => $this->__('Administrate'), 'class' => 'z-icon-es-config');
        }

        // return output
        return $links;
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:23,代碼來源:User.php

示例2: updateCategory

    public function updateCategory($args) {
        if (!SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_ADMIN)) {
            throw new Zikula_Exception_Fatal($this->__('Sorry! No authorization to access this module.'));
        }

        $categoryId = $this->request->getPost()->get('categoryId', '');
        if (!$categoryId) {
            throw new Zikula_Exception_Fatal($this->__('no category id'));
        }

        $categoryName = $this->request->getPost()->get('categoryName', '');
        $description = $this->request->getPost()->get('description', '');
        $active = $this->request->getPost()->get('active', '');
        $groups = $this->request->getPost()->get('groups', '');
        $groupsAdd = $this->request->getPost()->get('groupsAdd', '');

        $groupsArray = ($groups != '') ? explode('$$', substr($groups, 1, strlen($groups) - 2)) : array();
        $groupsAddArray = ($groupsAdd != '') ? explode('$$', substr($groupsAdd, 1, strlen($groupsAdd) - 2)) : array();

        $groupsString = serialize($groupsArray);
        $groupsAddString = serialize($groupsAddArray);

        $updated = ModUtil::apiFunc($this->name, 'admin', 'updateCategory', array('categoryId' => $categoryId,
                    'items' => array('categoryName' => $categoryName,
                        'description' => $description,
                        'groups' => $groupsString,
                        'groupsAdd' => $groupsAddString,
                        'active' => $active,
                        )));

        if (!$updated) {
            throw new Zikula_Exception_Fatal($this->__('Error updating the category'));
        }

        $content = ModUtil::Func($this->name, 'admin', 'viewCategoriesContent');

        return new Zikula_Response_Ajax(array('content' => $content,
                ));
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:39,代碼來源:Ajax.php

示例3: viewCategoriesContent

    public function viewCategoriesContent() {
        if (!SecurityUtil::checkPermission('IWdocmanager::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

        $categories = ModUtil::Func($this->name, 'admin', 'getCategoriesTree', array('parentId' => 0));

        $groupsArray = array();

        // get the intranet groups
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $groups = ModUtil::func('IWmain', 'user', 'getAllGroups', array('plus' => $this->__('All'),
                    'less' => ModUtil::getVar('IWmyrole', 'rolegroup'),
                    'sv' => $sv));

        $groups[] = array('id' => '-1',
            'name' => $this->__('Unregistered'));

        foreach ($groups as $group) {
            $groupsArray[$group['id']] = $group['name'];
        }

        return $this->view->assign('categories', $categories)
                        ->assign('groups', $groupsArray)
                        ->fetch('IWdocmanager_admin_viewCategoriesContent.tpl');
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:26,代碼來源:Admin.php

示例4: editDocument

    public function editDocument($args) {
        $documentId = FormUtil::getPassedValue('documentId', isset($args['documentId']) ? $args['documentId'] : 0, 'GET');
        $newVersion = FormUtil::getPassedValue('newVersion', isset($args['newVersion']) ? $args['newVersion'] : 0, 'GET');

        // get document
        $document = ModUtil::apiFunc($this->name, 'user', 'getDocument', array('documentId' => $documentId));
        if (!$document) {
            return LogUtil::registerError($this->__('Document not found.'));
        }

        if ($newVersion == 0) {
            // the documents only can be edited by people with EDIT_ACCESS to the module or by creators during the time defined in the module configuration
            if (!SecurityUtil::checkPermission('IWdocmanager::', "$document[categoryId]::", ACCESS_EDIT) && ($document['validated'] == 1 || UserUtil::getVar('uid') != $document['cr_uid'] || DateUtil::makeTimestamp($document['cr_date']) + $this->getVar('editTime') * 30 < time())) {
                return LogUtil::registerPermissionError();
            }
        } else {
            // check if user can access to this category
            $canAccess = ModUtil::func($this->name, 'user', 'canAccessCategory', array('categoryId' => $document['categoryId'],
                        'accessType' => 'add'));
            if (!$canAccess) {
                LogUtil::registerError($this->__('You can not add documents to this category'));
                return System::redirect(ModUtil::url($this->name, 'user', 'viewDocs'));
            }

            // protectionn. Only validated and not versioned documents can be versioned
            if ($document['validated'] == 0 || $document['versioned'] > 0) {
                LogUtil::registerError($this->__('It is not possible to create a version of this document.'));
                return System::redirect(ModUtil::url($this->name, 'user', 'viewDocs'));
            }
        }

        $categories = ModUtil::Func($this->name, 'user', 'getUserCategories', array('accessType' => 'add'));

        $extensions = str_replace('|', ', ', ModUtil::getVar('IWmain', 'extensions'));

        $function = ($newVersion) ? 'createDoc' : 'updateDoc';

        return $this->view->assign('document', $document)
                        ->assign('function', $function)
                        ->assign('extensions', $extensions)
                        ->assign('categories', $categories)
                        ->assign('categoryId', $document['categoryId'])
                        ->assign('newVersion', $newVersion)
                        ->fetch('IWdocmanager_user_addEditDoc.tpl');
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:45,代碼來源:User.php


注:本文中的ModUtil::Func方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。