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


PHP VmConfig::isAtLeastVersion方法代码示例

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


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

示例1: toggle

 /**
  * Additional grid function for custom toggles
  *
  * @return string HTML code to write the toggle button
  */
 function toggle($field, $i, $toggle, $untoggleable = false, $imgY = 'tick.png', $imgX = 'publish_x.png', $prefix = '')
 {
     $img = $field ? $imgY : $imgX;
     if ($toggle == 'published') {
         // Stay compatible with grid.published
         $task = $field ? 'unpublish' : 'publish';
         $alt = $field ? JText::_('COM_VIRTUEMART_PUBLISHED') : JText::_('COM_VIRTUEMART_UNPUBLISHED');
         $action = $field ? JText::_('COM_VIRTUEMART_UNPUBLISH_ITEM') : JText::_('COM_VIRTUEMART_PUBLISH_ITEM');
     } else {
         $task = $field ? $toggle . '.0' : $toggle . '.1';
         $alt = $field ? JText::_('COM_VIRTUEMART_ENABLED') : JText::_('COM_VIRTUEMART_DISABLED');
         $action = $field ? JText::_('COM_VIRTUEMART_DISABLE_ITEM') : JText::_('COM_VIRTUEMART_ENABLE_ITEM');
     }
     if (VmConfig::isAtLeastVersion('1.6.0')) {
         $img = 'admin/' . $img;
     }
     $retImgSrc = JHTML::_('image.administrator', $img, '/images/', null, null, $alt);
     if ($untoggleable) {
         return $retImgSrc;
     } else {
         return '<a href="javascript:void(0);" onclick="return listItemTask(\'cb' . $i . '\',\'' . $task . '\')" title="' . $action . '">' . $retImgSrc . '</a>';
     }
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:28,代码来源:view.html.php

示例2: getGroupList

 /**
  * Return a list with groups that can be set by the current user
  *
  * @return mixed Array with groups that can be set, or the groupname (string) if it cannot be changed.
  */
 function getGroupList()
 {
     if (JVM_VERSION === 2) {
         //hm CB thing also not help
         // 			$_grpList = $this->get_groups_below_me();
         // 			return $_grpList;
         /*			if(!class_exists('UsersModelUser')) require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_users'.DS.'models'.DS.'user.php');
         			 $jUserModel = new UsersModelUser();
         			$list = $jUserModel->getGroups();
         
         			$user = JFactory::getUser();
         			if ($user->authorise('core.edit', 'com_users') && $user->authorise('core.manage', 'com_users'))
         			{
         			$model = JModel::getInstance('Groups', 'UsersModel', array('ignore_request' => true));
         			return $model->getItems();
         			}
         			else
         			{
         			return null;
         			}*/
         $user = JFactory::getUser();
         $authGroups = JAccess::getGroupsByUser($user->id);
         // 			$authGroups = $user->getAuthorisedGroups();
         // 			vmdebug('getGroupList j17',$authGroups);
         $db =& $this->getDbo();
         $where = implode($authGroups, '" OR `id` = "') . '"';
         $q = 'SELECT `id` as value,`title` as text FROM #__usergroups WHERE `id` = "' . $where;
         $db->setQuery($q);
         $list = $db->loadAssocList();
         // 			foreach($list as $item){
         // 				vmdebug('getGroupList $item ',$item);
         // 			}
         // 			vmdebug('getGroupList $q '.$list);
         return $list;
     } else {
         $_aclObject = JFactory::getACL();
         if (empty($this->_data)) {
             $this->getUser();
         }
         if (VmConfig::isAtLeastVersion('1.6.0')) {
             //TODO fix this latter. It's just an workarround to make it working on 1.6
             $gids = $this->_data->JUser->get('groups');
             return array_flip($gids);
         }
         $_usr = $_aclObject->get_object_id('users', $this->_data->JUser->get('id'), 'ARO');
         $_grp = $_aclObject->get_object_groups($_usr, 'ARO');
         $_grpName = strtolower($_aclObject->get_group_name($_grp[0], 'ARO'));
         $_currentUser = JFactory::getUser();
         $_my_usr = $_aclObject->get_object_id('users', $_currentUser->get('id'), 'ARO');
         $_my_grp = $_aclObject->get_object_groups($_my_usr, 'ARO');
         $_my_grpName = strtolower($_aclObject->get_group_name($_my_grp[0], 'ARO'));
         // administrators can't change each other and frontend-only users can only see groupnames
         if ($_grpName == $_my_grpName && $_my_grpName == 'administrator' || !$_aclObject->is_group_child_of($_my_grpName, 'Public Backend')) {
             return $_grpName;
         } else {
             $_grpList = $_aclObject->get_group_children_tree(null, 'USERS', false);
             $_remGroups = $_aclObject->get_group_children($_my_grp[0], 'ARO', 'RECURSE');
             if (!$_remGroups) {
                 $_remGroups = array();
             }
             // Make sure privs higher than my own can't be granted
             if (in_array($_grp[0], $_remGroups)) {
                 // nor can privs of users with higher privs be decreased.
                 return $_grpName;
             }
             $_i = 0;
             $_j = count($_grpList);
             while ($_i < $_j) {
                 if (in_array($_grpList[$_i]->value, $_remGroups)) {
                     array_splice($_grpList, $_i, 1);
                     $_j = count($_grpList);
                 } else {
                     $_i++;
                 }
             }
             return $_grpList;
         }
     }
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:84,代码来源:user.php


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