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


PHP DBUtil::selectFieldMax方法代码示例

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


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

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

示例2: correctGroupPermissions

    /**
     * Check if the group that can change roles have the correct permissions
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param:	Array with the id of the group where the user will be enroled
     * @return:	True if success and false in other case
     */
    public function correctGroupPermissions($args) {
        // Security check
        if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }
        // Get the min sequence value
        $pos = DBUtil::selectFieldMax('group_perms', 'sequence', 'MIN') + 1;

        $pntable = & DBUtil::getTables();
        $c = $pntable['group_perms_column'];

        $where = "$c[gid] = " . ModUtil::getVar('IWmyrole', 'rolegroup') . " AND $c[component] = 'IWmyrole::' AND $c[level] = 800 AND $c[sequence] = $pos";
        // get the objects from the db
        $items = DBUtil::selectObjectArray('group_perms', $where);

        // Check for an error with the database code, and if so set an appropriate
        // error message and return
        if ($items === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }

        // Return the items
        return $items;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:30,代码来源:Admin.php

示例3: __construct

 /**
  * constructor
  */
 public function __construct()
 {
     $this->tablePrefix = System::getVar('prefix');
     $this->structureIndex = DBUtil::selectFieldMax('content_page', 'setRight');
 }
开发者ID:robbrandt,项目名称:Content,代码行数:8,代码来源:AbstractModule.php

示例4: edit

 /**
  * Modify the categories, labels, custom fields
  */
 public function edit()
 {
     // Security check
     if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $ot = FormUtil::getPassedValue('ot', 'categories', 'GET');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GET');
     $class = 'AddressBook_DBObject_' . ucfirst($ot);
     if (!class_exists($class)) {
         return z_exit($this->__f('Error! Unable to load class [%s]', $ot));
     }
     $data = array();
     if ($id) {
         $object = new $class();
         $data = $object->get($id);
     } else {
         $data['id'] = 0;
     }
     $this->view->assign($ot, $data);
     if ($ot == "customfield") {
         $new_position = DBUtil::selectFieldMax('addressbook_customfields', 'position') + 1;
         $this->view->assign('new_position', $new_position);
     }
     return $this->view->fetch('admin_' . $ot . '_edit.tpl');
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:29,代码来源:Admin.php

示例5: getweightlimits

    /**
     * Utility function to get the weight limits.
     *
     * @return array|boolean Array of weight limits (min and max), or false on failure.
     */
    public function getweightlimits()
    {
        // Get datbase setup
        $dbtable = DBUtil::getTables();
        $column  = $dbtable['user_property_column'];

        $where = "WHERE {$column['prop_weight']} != 0";
        $max   = DBUtil::selectFieldMax('user_property', 'prop_weight', 'MAX', $where);

        $where = "WHERE {$column['prop_weight']} != 0";
        $min   = DBUtil::selectFieldMax('user_property', 'prop_weight', 'MIN', $where);

        // Return the number of items
        return array('min' => $min, 'max' => $max);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:20,代码来源:User.php

示例6: mediashareGetNewPosition

function mediashareGetNewPosition($albumId)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $pntable = pnDBGetTables();
    $mediaColumn = $pntable['mediashare_media_column'];
    $where = "{$mediaColumn['parentAlbumId']} = {$albumId}";
    $max = DBUtil::selectFieldMax('mediashare_media', 'position', 'MAX', $where);
    if ($max === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('editapi.mediashareGetNewPosition', 'Could not get the max position.'), $dom));
    }
    return empty($max) ? 0 : $max + 1;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:12,代码来源:pneditapi.php

示例7: reserva

    public function reserva($args) {
        $sid = FormUtil::getPassedValue('sid', isset($args['sid']) ? $args['sid'] : null, 'GET');
        $start = FormUtil::getPassedValue('start', isset($args['start']) ? $args['start'] : null, 'GET');
        $end = FormUtil::getPassedValue('end', isset($args['end']) ? $args['end'] : null, 'GET');
        $group = FormUtil::getPassedValue('usrgroup', isset($args['usrgroup']) ? $args['usrgroup'] : null, 'GET');
        $user = FormUtil::getPassedValue('user', isset($args['user']) ? $args['user'] : null, 'GET');
        $reason = FormUtil::getPassedValue('reason', isset($args['reason']) ? $args['reason'] : null, 'GET');
        $nsessions = FormUtil::getPassedValue('nsessions', isset($args['nsessions']) ? $args['nsessions'] : null, 'GET');
        $nbooking = FormUtil::getPassedValue('nbooking', isset($args['nbooking']) ? $args['nbooking'] : null, 'GET');
        $admin = FormUtil::getPassedValue('admin', isset($args['admin']) ? $args['admin'] : null, 'GET');

        //Comprova que la identitat de l'espai de reserva efectivament hagi arribat
        if ((!isset($sid))) {
            return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
        }
        // Security check
        if (!SecurityUtil::checkPermission('IWbookings::', "::", ACCESS_ADD)) {
            return LogUtil::registerError($this->__('You are not allowed to administrate the bookings'), 403);
        }

        // Identificates grouped bookings: has the same day of week and time during n consecutive weeks
        $key = DBUtil::selectFieldMax('IWbookings', 'bid') + 1;
        if (empty($nbooking))
            $nbooking = $key;

        // Get day of week
        $dow = date("w", DateUtil::makeTimeStamp($start));
        ($dow == 0) ? $dow = 7 : "";
        ($admin) ? $temp = 1 : 0;
        $item = array('sid' => $sid,
            'user' => $user,
            'usrgroup' => $group,
            'start' => $start,
            'end' => $end,
            'reason' => $reason,
            'dayofweek' => $dow,
            'bkey' => $nbooking,
            'temp' => $temp);
        if (!DBUtil::insertObject($item, 'IWbookings', 'bid')) {
            LogUtil::registerError($this->__('Error! Creation attempt failed.'));
            return false;
        }

        // Return the id of the newly created item to the calling process
        return $nbooking;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:46,代码来源:User.php


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