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


PHP K2HelperPermissions::canAddTag方法代碼示例

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


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

示例1: checkPermissions

 public static function checkPermissions()
 {
     $view = JRequest::getCmd('view');
     if ($view != 'item') {
         return;
     }
     $task = JRequest::getCmd('task');
     $user = JFactory::getUser();
     if ($user->guest && ($task == 'add' || $task == 'edit')) {
         $mainframe = JFactory::getApplication();
         $uri = JURI::getInstance();
         $return = base64_encode($uri->toString());
         $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
         if (K2_JVERSION == '15') {
             $mainframe->redirect('index.php?option=com_user&view=login&return=' . $return . '&tmpl=component');
         } else {
             $mainframe->redirect('index.php?option=com_users&view=login&return=' . $return . '&tmpl=component');
         }
     }
     switch ($task) {
         case 'add':
             if (!K2HelperPermissions::canAddItem()) {
                 JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
             }
             break;
         case 'edit':
         case 'deleteAttachment':
         case 'checkin':
             $cid = JRequest::getInt('cid');
             if (!$cid) {
                 JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
             }
             JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
             $item = JTable::getInstance('K2Item', 'Table');
             $item->load($cid);
             if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
                 JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
             }
             break;
         case 'save':
             $cid = JRequest::getInt('id');
             if ($cid) {
                 JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
                 $item = JTable::getInstance('K2Item', 'Table');
                 $item->load($cid);
                 if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
                     JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
                 }
             } else {
                 if (!K2HelperPermissions::canAddItem()) {
                     JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
                 }
             }
             break;
         case 'tag':
             if (!K2HelperPermissions::canAddTag()) {
                 JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
             }
             break;
         case 'extraFields':
             if (!K2HelperPermissions::canRenderExtraFields()) {
                 JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
             }
             break;
     }
 }
開發者ID:educakanchay,項目名稱:educa,代碼行數:66,代碼來源:permissions.php

示例2: checkPermissions

 function checkPermissions()
 {
     $view = JRequest::getCmd('view');
     if ($view != 'item') {
         return;
     }
     $task = JRequest::getCmd('task');
     switch ($task) {
         case 'add':
             if (!K2HelperPermissions::canAddItem()) {
                 JError::raiseError(403, JText::_("ALERTNOTAUTH"));
             }
             break;
         case 'edit':
         case 'deleteAttachment':
         case 'checkin':
             $cid = JRequest::getInt('cid');
             if (!$cid) {
                 JError::raiseError(403, JText::_("ALERTNOTAUTH"));
             }
             JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
             $item =& JTable::getInstance('K2Item', 'Table');
             $item->load($cid);
             if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
                 JError::raiseError(403, JText::_("ALERTNOTAUTH"));
             }
             break;
         case 'save':
             $cid = JRequest::getInt('id');
             if ($cid) {
                 JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
                 $item =& JTable::getInstance('K2Item', 'Table');
                 $item->load($cid);
                 if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
                     JError::raiseError(403, JText::_("ALERTNOTAUTH"));
                 }
             } else {
                 if (!K2HelperPermissions::canAddItem()) {
                     JError::raiseError(403, JText::_("ALERTNOTAUTH"));
                 }
             }
             break;
         case 'tag':
             if (!K2HelperPermissions::canAddTag()) {
                 JError::raiseError(403, JText::_("ALERTNOTAUTH"));
             }
             break;
         case 'extraFields':
             if (!K2HelperPermissions::canRenderExtraFields()) {
                 JError::raiseError(403, JText::_("ALERTNOTAUTH"));
             }
             break;
     }
 }
開發者ID:navinpai,項目名稱:GEC-Tandav,代碼行數:54,代碼來源:permissions.php


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