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


PHP DBUtil::selectExpandedObjectArray方法代码示例

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


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

示例1: getAllActivities

    /**
     * Get the properties of the activities that a user have got assigned
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @return:	An array with the activity proporties
     */
    public function getAllActivities($args) {
        // Security check
        if (!SecurityUtil::checkPermission('IWjclic::', "::", ACCESS_READ)) {
            throw new Zikula_Exception_Forbidden();
        }

        $uid = UserUtil::getVar('uid');

        //get all the groups of the user
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $userGroups = ModUtil::func('IWmain', 'user', 'getAllUserGroups', array('uid' => $uid,
                    'sv' => $sv));

        $myJoin = array();

        $myJoin[] = array('join_table' => 'IWjclic',
            'join_field' => array(),
            'object_field_name' => array(),
            'compare_field_table' => 'jid',
            'compare_field_join' => 'jid');
        $myJoin[] = array('join_table' => 'IWjclic_groups',
            'join_field' => array(),
            'object_field_name' => array(),
            'compare_field_table' => 'jid',
            'compare_field_join' => 'jid');

        $pntables = DBUtil::getTables();

        $ocolumn = $pntables['IWjclic_column'];
        $lcolumn = $pntables['IWjclic_groups_column'];

        $where = "(";
        $orderby = "a.$ocolumn[date]";

        foreach ($userGroups as $group) {
            $where .= "b.$lcolumn[group_id]=" . $group['id'] . ' OR ';
        }

        $where = substr($where, 0, -3);

        $where .= ") AND a.$ocolumn[active] = 1";

        $items = DBUtil::selectExpandedObjectArray('IWjclic', $myJoin, $where, $orderby, '-1', '-1', 'jid');

        if ($items === false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }

        // get the user activities that the user has made independently of the groups.
        // In case the activity groups changes but the user have made an activity he/she can accés to the activity information
        // marge the items in the two requests
        // Return the items
        return $items;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:59,代码来源:User.php

示例2: select

 /**
  * Select the object from the database using the specified key (and field).
  *
  * @param string $key   The record's key value (if init is a string directive).
  * @param string $field The key-field we wish to select by (optional) (default=null, reverts to this->_objField).
  * @param string $where The key-field we wish to select by (optional) (default='').
  *
  * @return array The object's data value.
  */
 public function select($key, $field = '', $where = '')
 {
     if (!$this->_objType) {
         return array();
     }
     if (!$field) {
         $field = $this->_objField;
     }
     if ((!$key || !$field) && !$where) {
         return array();
     }
     // use explicit where clause
     if ($where) {
         if ($this->_objJoin) {
             $objArray = DBUtil::selectExpandedObjectArray($this->_objType, $this->_objJoin, $where, '', -1, -1, '', $this->_objPermissionFilter, $this->_objCategoryFilter, $this->_objColumnArray);
         } else {
             $objArray = DBUtil::selectObjectArray($this->_objType, $where, '', -1, -1, '', $this->_objPermissionFilter, $this->_objCategoryFilter, $this->_objColumnArray);
         }
         if ($objArray === false) {
             $this->_objData = false;
         } else {
             if (isset($objArray[0])) {
                 $this->_objData = $objArray[0];
             } else {
                 $this->_objData = array();
             }
         }
         $this->_objKey = $where;
     } else {
         // generic key=>value lookup
         if ($this->_objJoin) {
             $this->_objData = DBUtil::selectExpandedObjectById($this->_objType, $this->_objJoin, $key, $field, $this->_objColumnArray, $this->_objPermissionFilter, $this->_objCategoryFilter);
         } else {
             $this->_objData = DBUtil::selectObjectById($this->_objType, $key, $field, $this->_objColumnArray, $this->_objPermissionFilter, $this->_objCategoryFilter);
         }
         $this->_objKey = $key;
         $this->_objField = $field;
     }
     $this->selectPostProcess();
     return $this->_objData;
 }
开发者ID:Silwereth,项目名称:core,代码行数:50,代码来源:DBObject.php

示例3: countUsers

 /**
  * Count the number of users for a specific filter
  * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
  * @param:	args   filter values
  * @return:	The number of users
  */
 public function countUsers($args) {
     $filtre = FormUtil::getPassedValue('filtre', isset($args['filtre']) ? $args['filtre'] : null, 'POST');
     $campfiltre = FormUtil::getPassedValue('campfiltre', isset($args['campfiltre']) ? $args['campfiltre'] : null, 'POST');
     // Security check
     if (!SecurityUtil::checkPermission('IWusers::', '::', ACCESS_READ)) {
         throw new Zikula_Exception_Forbidden();
     }
     if ($filtre == '0') {
         $filtre = '';
     }
     $myJoin = array();
     $myJoin[] = array('join_table' => 'users',
         'join_field' => array('uid'),
         'object_field_name' => array('uid'),
         'compare_field_table' => 'uid',
         'compare_field_join' => 'uid');
     $myJoin[] = array('join_table' => 'IWusers',
         'join_field' => array(),
         'object_field_name' => array(),
         'compare_field_table' => 'uid',
         'compare_field_join' => 'uid');
     $pntables = DBUtil::getTables();
     $ccolumn = $pntables['users_column'];
     $ocolumn = $pntables['IWusers_column'];
     switch ($campfiltre) {
         case 'n':
             $where = "b.$ocolumn[uid] = a.$ccolumn[uid] AND b.$ocolumn[nom]<>'' AND b.$ocolumn[nom] like '" . $filtre . "%'";
             $orderby = "order by b.$ocolumn[nom]";
             break;
         case 'c1':
             $where = "b.$ocolumn[uid] = a.$ccolumn[uid] AND b.$ocolumn[cognom1]<>'' AND b.$ocolumn[cognom1] like '" . $filtre . "%'";
             $orderby = "order by b.$ocolumn[cognom1]";
             break;
         case 'c2':
             $where = "b.$ocolumn[uid] = a.$ccolumn[uid] AND b.$ocolumn[cognom2]<>'' AND b.$ocolumn[cognom2] like '" . $filtre . "%'";
             $orderby = "order by b.$ocolumn[cognom2]";
             break;
         default:
             $where = "b.$ocolumn[uid] = a.$ccolumn[uid] AND a.$ccolumn[uname] like '" . $filtre . "%'";
             $orderby = "order by a.$ccolumn[uname]";
     }
     $items = DBUtil::selectExpandedObjectArray('IWusers', $myJoin, $where, $orderby, '-1', '-1', 'uid');
     // Check for an error with the database code, and if so set an appropriate
     // error message and return
     if ($items === false) {
         return LogUtil::registerError(_SELECTFAILED);
     }
     return count($items);
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:User.php

示例4: expandObjectArrayWithCategories

 /**
  * Expand an object array with it's category data.
  *
  * @param array  &$objArray The object array we wish to get the category for.
  * @param string $tablename The object's tablename.
  * @param string $idcolumn  The object's idcolumn (optional) (default='id').
  * @param string $field     The category field to return the object's category info (optional) (default='id').
  * @param string $locale    Locale.
  *
  * @return The object with the meta data filled in. The object passed in is altered in place
  */
 public static function expandObjectArrayWithCategories(&$objArray, $tablename, $idcolumn = 'id', $field = 'id', $locale = 'en')
 {
     if (!ModUtil::dbInfoLoad('ZikulaCategoriesModule')) {
         return false;
     }
     if (!$objArray || !is_array($objArray)) {
         return false;
     }
     $pntabs = DBUtil::getTables();
     $tab = $pntabs['categories_mapobj'];
     $col = $pntabs['categories_mapobj_column'];
     $w1 = array();
     $w2 = array();
     foreach ($objArray as $obj) {
         $w1[] = DataUtil::formatForStore($obj[$idcolumn]);
     }
     $t = implode(',', $w1);
     $w2[] = "tbl.{$col['obj_id']} IN (" . $t . ')';
     $w2[] = "tbl.{$col['table']}='" . DataUtil::formatForStore($tablename) . "' AND tbl.{$col['obj_idcolumn']}='" . DataUtil::formatForStore($idcolumn) . "' ";
     $where = "WHERE " . implode(' AND ', $w2);
     $sort = "ORDER BY tbl.{$col['obj_id']}, tbl.{$col['category_id']}";
     $joinInfo[] = array('join_table' => 'categories_registry', 'join_field' => 'property', 'object_field_name' => 'property', 'compare_field_table' => 'reg_id', 'compare_field_join' => 'id');
     $maps = DBUtil::selectExpandedObjectArray('categories_mapobj', $joinInfo, $where, $sort);
     if (!$maps) {
         return false;
     }
     // since we don't know the order in which our data array will be, we
     // have to do this iteratively. However, this is still a lot faster
     // than doing a select for every data line.
     $catlist = array();
     foreach ($objArray as $k => $obj) {
         $last = null;
         foreach ($maps as $map) {
             if ($map['obj_id'] == $obj[$idcolumn]) {
                 $last = $map['obj_id'];
                 $prop = $map['property'];
                 $catid = $map['category_id'];
                 $objArray[$k]['__CATEGORIES__'][$prop] = $catid;
                 $catlist[] = $catid;
             }
             if ($last && $last != $map['obj_id']) {
                 break;
             }
         }
     }
     // now retrieve the full category data
     $where = 'WHERE id IN (' . implode(',', $catlist) . ')';
     $catArray = new Categories_DBObject_CategoryArray();
     $data = $catArray->get($where, '', -1, -1, 'id');
     // use the cagtegory map created previously to build the object category array
     foreach ($objArray as $k => $obj) {
         if (isset($obj['__CATEGORIES__'])) {
             foreach ($obj['__CATEGORIES__'] as $prop => $cat) {
                 $data[$cat]['path'] = str_replace('__SYSTEM__', __('Root Category'), $data[$cat]['path']);
                 $objArray[$k]['__CATEGORIES__'][$prop] = $data[$cat];
             }
         }
     }
     // now generate the relative paths
     //$rootCatID = CategoryRegistryUtil::getRegisteredModuleCategory (ModUtil::getName(), $tablename, 'main_table', '/__SYSTEM__/Modules/Quotes/Default');
     //postProcessExpandedObjectArrayCategories ($objArray, $rootCatID, false);
     return $objArray;
 }
开发者ID:Silwereth,项目名称:core,代码行数:74,代码来源:ObjectUtil.php

示例5: getNoteContent

    /**
     * get the contents for a field
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param:	the note id
     * @return:	An array with the fields contents of note
     */
    public function getNoteContent($args) {

        $fnid = (isset($args['fnid'])) ? $args['fnid'] : null;

        $pntable = DBUtil::getTables();

        $myJoin = array();

        $myJoin[] = array('join_table' => 'IWforms_note',
            'join_field' => array(),
            'object_field_name' => array(),
            'compare_field_table' => 'fnid',
            'compare_field_join' => 'fnid');

        $myJoin[] = array('join_table' => 'IWforms_note_definition',
            'join_field' => array('fieldName',
                'fieldType',
                'editable'),
            'object_field_name' => array('fieldName',
                'fieldType',
                'editable'),
            'compare_field_table' => 'fndid',
            'compare_field_join' => 'fndid');

        $pntables = DBUtil::getTables();

        $ocolumn = $pntables['IWforms_note_column'];
        $lcolumn = $pntables['IWforms_note_definition_column'];

        $where = "a.$ocolumn[fnid] = $fnid";

        $items = DBUtil::selectExpandedObjectArray('IWforms_note', $myJoin, $where, '', '-1', '-1', 'fnid');

        // 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.'));
        }

        // 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->__('You can not access this form to send annotations'));
        }

        // check if user can access the form is validator
        // get note
        $note = ModUtil::apiFunc('IWforms', 'user', 'getNote', array('fmid' => $items[$fnid]['fmid']));
        // check if user can access the form is validator and the note is editable
        $access = ModUtil::func('IWforms', 'user', 'access', array('fid' => $note['fid']));
        if ($access['level'] < 7) {
            return LogUtil::registerError($this->__('You can not access this form to send annotations'));
        }

        // Return the items
        return array('content' => $items[$fnid]['content'],
            'fmid' => $items[$fnid]['fmid'],
            'fnid' => $items[$fnid]['fnid'],
            'editable' => $items[$fnid]['editable']);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:66,代码来源:User.php

示例6: select

 /**
  * Generic select handler for an object. Select (and set) the specified object array.
  *
  * @param string  $where        The where-clause to use.
  * @param string  $orderBy      The order-by clause to use.
  * @param integer $limitOffset  The limiting offset.
  * @param integer $limitNumRows The limiting number of rows.
  * @param string  $assocKey     Key field to use for building an associative array (optional) (default=null).
  * @param boolean $distinct     Whether or not to use the distinct clause.
  *
  * @return array The selected Object-Array.
  */
 public function select($where = '', $orderBy = '', $limitOffset = -1, $limitNumRows = -1, $assocKey = false, $distinct = false)
 {
     if ($this->_objJoin) {
         $objArr = DBUtil::selectExpandedObjectArray($this->_objType, $this->_objJoin, $where, $orderBy, $limitOffset, $limitNumRows, $assocKey, $this->_objPermissionFilter, $this->_objCategoryFilter, $this->_objColumnArray);
     } else {
         $objArr = DBUtil::selectObjectArray($this->_objType, $where, $orderBy, $limitOffset, $limitNumRows, $assocKey, $this->_objPermissionFilter, $this->_objCategoryFilter, $this->_objColumnArray);
     }
     $this->_objData = $objArr;
     $this->_objWhere = $where;
     $this->_objSort = $orderBy;
     $this->_objLimitOffset = $limitOffset;
     $this->_objLimitNumRows = $limitNumRows;
     $this->_objAssocKey = $assocKey;
     $this->_objDistinct = $distinct;
     $this->selectPostProcess();
     return $this->_objData;
 }
开发者ID:Silwereth,项目名称:core,代码行数:29,代码来源:DBObjectArray.php

示例7: permisos

 /**
  * Get the user permissions for the noteboard
  * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
  * @param:	args	The id of the note
  * 			The string of mached notes by the user
  * @return:	True if success and false otherwise
  */
 public function permisos($args) {
     $uid = FormUtil::getPassedValue('uid', isset($args['uid']) ? $args['uid'] : UserUtil::getVar('uid'), 'POST');
     $sv = FormUtil::getPassedValue('sv', isset($args['sv']) ? $args['sv'] : null, 'POST');
     $requestByCron = false;
     if (!ModUtil::func('IWmain', 'user', 'checkSecurityValue', array('sv' => $sv))) {
         // Security check
         if (!SecurityUtil::checkPermission('IWnoteboard::', '::', ACCESS_READ)) {
             return LogUtil::registerPermissionError();
         }
     } else {
         $requestByCron = true;
     }
     $n_permisos = 0;
     $nivell_permisos = array();
     //if user is not registered have a fixed permissions
     if (!UserUtil::isLoggedIn() && !$requestByCron) {
         $nivell_permisos = array('nivell' => 1,
             'verifica' => 2,
             'potverificar' => false,
             'grups' => array(0));
         //return not registered permissions
         return $nivell_permisos;
     }
     // Arguments needed
     if (!isset($uid) || ($uid != UserUtil::getVar('uid') && !$requestByCron)) {
         SessionUtil::setVar('errormsg', $this->__('Error! Could not do what you wanted. Please check your input.'));
         return $nivell_permisos;
     }
     $myJoin = array();
     $myJoin[] = array('join_table' => 'groups',
         'join_field' => array('gid'),
         'object_field_name' => array('gid'),
         'compare_field_table' => 'gid',
         'compare_field_join' => 'gid');
     $myJoin[] = array('join_table' => 'group_membership',
         'join_field' => array(),
         'object_field_name' => array(),
         'compare_field_table' => 'gid',
         'compare_field_join' => 'gid');
     $pntables = DBUtil::getTables();
     $ccolumn = $pntables['groups_column'];
     $ocolumn = $pntables['group_membership_column'];
     $where = "b.$ocolumn[gid] = a.$ccolumn[gid] AND b.$ocolumn[uid] = $uid";
     $items = DBUtil::selectExpandedObjectArray('groups', $myJoin, $where, '');
     // Check for an error with the database code, and if so set an appropriate
     // error message and return
     if ($items === false) {
         return $nivell_permisos;
     }
     $verifica = 2;
     $potverificar = false;
     $permisosModVar = ModUtil::getVar('IWnoteboard', 'permisos');
     $verificaModVar = ModUtil::getVar('IWnoteboard', 'verifica');
     $quiverificaModVar = ModUtil::getVar('IWnoteboard', 'quiverifica');
     foreach ($items as $item) {
         // get user permissions level
         $permis = substr($permisosModVar, strpos($permisosModVar, '$' . $item['gid'] . '-') + strlen($item['gid']) + 2, 1);
         $verifica = (strpos($verificaModVar, '$' . $item['gid'] . '$') != 0 && $verifica != 1) ? 0 : 1;
         if ($permis > $n_permisos) {
             $n_permisos = $permis;
         }
         if ($quiverificaModVar == $item['gid']) {
             $potverificar = true;
         }
         $grups[] = $item['gid'];
     }
     $nivell_permisos = array('nivell' => $n_permisos,
         'verifica' => $verifica,
         'potverificar' => $potverificar,
         'grups' => $grups);
     return $nivell_permisos;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:79,代码来源:User.php

示例8: avissubscripcio

    /**
     * Get the agendas where the user has been subscribed
     *
     * @return An array with the agendas where the user has been subscribed
     */
    public function avissubscripcio()
    {
        // Security check
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('IWagendas::', '::', ACCESS_READ));

        $uid = UserUtil::getVar('uid');
        $myJoin = array();
        $myJoin[] = array('join_table' => 'IWagendas_subs',
            'join_field' => array('uid'),
            'object_field_name' => array('uid'),
            'compare_field_table' => 'daid',
            'compare_field_join' => 'daid');
        $myJoin[] = array('join_table' => 'IWagendas_definition',
            'join_field' => array(),
            'object_field_name' => array(),
            'compare_field_table' => 'daid',
            'compare_field_join' => 'daid');
        $pntables = DBUtil::getTables();
        $ccolumn = $pntables['IWagendas_subs_column'];
        $ocolumn = $pntables['IWagendas_definition_column'];
        $where = "b.$ocolumn[daid] = a.$ccolumn[daid] AND $ccolumn[donadabaixa] = '-2' AND $ccolumn[uid] = $uid";
        $items = DBUtil::selectExpandedObjectArray('IWagendas_definition', $myJoin, $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 $items;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:34,代码来源:User.php

示例9: getMembersGroup

 /**
  * Get the members of a group
  * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
  * @return:	And array with the users
  */
 public function getMembersGroup($args) {
     $sv = FormUtil::getPassedValue('sv', isset($args['sv']) ? $args['sv'] : null, 'POST');
     $gid = FormUtil::getPassedValue('gid', isset($args['gid']) ? $args['gid'] : null, 'POST');
     if (!ModUtil::func('IWmain', 'user', 'checkSecurityValue', array('sv' => $sv))) {
         return LogUtil::registerError($this->__('You are not allowed to access to some information.'));
     }
     $myJoin = array();
     $myJoin[] = array('join_table' => 'users',
         'join_field' => array('uid'),
         'object_field_name' => array('uid'),
         'compare_field_table' => 'uid',
         'compare_field_join' => 'uid');
     $myJoin[] = array('join_table' => 'group_membership',
         'join_field' => array(),
         'object_field_name' => array(),
         'compare_field_table' => 'uid',
         'compare_field_join' => 'uid');
     $tables = DBUtil::getTables();
     $ccolumn = $tables['users_column'];
     $ocolumn = $tables['group_membership_column'];
     $where = "b.$ocolumn[gid] = " . $gid;
     $orderBy = "ORDER BY tbl.$ccolumn[uname]";
     $items = DBUtil::selectExpandedObjectArray('users', $myJoin, $where, $orderBy);
     return $items;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:30,代码来源:User.php


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