本文整理汇总了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;
}
示例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,
));
}
示例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');
}
示例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');
}