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


PHP ilUtil::quoteArray方法代码示例

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


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

示例1: ilMDConvert

function ilMDConvert($table, $fields, $key)
{
    global $ilDB;
    $where = "WHERE ";
    $where .= implode(" LIKE '%\\%' ESCAPE '�' OR ", ilUtil::quoteArray($fields));
    $where .= " LIKE '%\\%' ESCAPE '�'";
    $query = "SELECT * FROM " . $table . " " . $where;
    $res = $ilDB->query($query);
    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
        $query = "UPDATE {$table} ";
        $counter = 0;
        foreach ($fields as $field) {
            if ($counter++) {
                $query .= ", ";
            } else {
                $query .= "SET ";
            }
            $query .= $field . " = " . $ilDB->quote(stripslashes($row->{$field})) . " ";
        }
        $query .= " WHERE " . $key . " = " . $ilDB->quote($row->{$key});
        // Perform the query
        $ilDB->query($query);
    }
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:inc.meta_data_converter.php

示例2: getChildsByTypeFilter

 /**
  * get child nodes of given node by object type
  * @access	public
  * @param	integer		node_id
  * @param	array		array of object type
  * @return	array		with node data of all childs or empty array
  */
 public function getChildsByTypeFilter($a_node_id, $a_types)
 {
     global $ilDB;
     if (!isset($a_node_id) or !$a_types) {
         $message = get_class($this) . "::getChildsByType(): Missing parameter! node_id:" . $a_node_id . " type:" . $a_types;
         $this->ilErr->raiseError($message, $this->ilErr->WARNING);
     }
     $filter = ' ';
     if ($a_types) {
         $filter = 'AND ' . $this->table_obj_data . '.type IN(' . implode(',', ilUtil::quoteArray($a_types)) . ') ';
     }
     $query = 'SELECT * FROM ' . $this->table_tree . ' ' . $this->buildJoin() . 'WHERE parent = ' . $ilDB->quote($a_node_id, 'integer') . ' ' . 'AND ' . $this->table_tree . '.' . $this->tree_pk . ' = ' . $ilDB->quote($this->tree_id, 'integer') . ' ' . $filter . 'ORDER BY ' . $this->table_tree . '.lft';
     $res = $ilDB->query($query);
     while ($row = $ilDB->fetchAssoc($res)) {
         $childs[] = $this->fetchNodeData($row);
     }
     return $childs ? $childs : array();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:25,代码来源:class.ilTree.php

示例3: _sortIds

 /**
  * Function that sorts ids by a given table field using WHERE IN
  * E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname
  *
  * @param array Array of ids
  * @param string table name
  * @param string table field
  * @param string id name
  * @return array sorted ids
  *
  * @access protected
  * @static
  * 
  */
 public static function _sortIds($a_ids, $a_table, $a_field, $a_id_name)
 {
     global $ilDB;
     if (!$a_ids) {
         return array();
     }
     // use database to sort user array
     $where = "WHERE " . $a_id_name . " IN (";
     $where .= implode(",", ilUtil::quoteArray($a_ids));
     $where .= ") ";
     $query = "SELECT " . $a_id_name . " FROM " . $a_table . " " . $where . "ORDER BY " . $a_field;
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $ids[] = $row->{$a_id_name};
     }
     return $ids ? $ids : array();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:31,代码来源:class.ilUtil.php

示例4: _isMember

 function _isMember($a_user_id, $a_ref_id, $a_field = '')
 {
     global $rbacreview, $ilObjDataCache, $ilDB;
     $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
     $local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"], false);
     $user_roles = $rbacreview->assignedRoles($a_user_id);
     // Used for membership limitations -> check membership by given field
     if ($a_field) {
         include_once './Services/User/classes/class.ilObjUser.php';
         $tmp_user =& ilObjectFactory::getInstanceByObjId($a_user_id);
         switch ($a_field) {
             case 'login':
                 $and = "AND login = '" . $tmp_user->getLogin() . "' ";
                 break;
             case 'email':
                 $and = "AND email = '" . $tmp_user->getEmail() . "' ";
                 break;
             case 'matriculation':
                 $and = "AND matriculation = '" . $tmp_user->getMatriculation() . "' ";
                 break;
             default:
                 $and = "AND usr_id = '" . $a_user_id . "'";
                 break;
         }
         if (!($members = ilObjGroup::_getMembers($ilObjDataCache->lookupObjId($a_ref_id)))) {
             return false;
         }
         $query = "SELECT * FROM usr_data as ud " . "WHERE usr_id IN (" . implode(",", ilUtil::quoteArray($members)) . ") " . $and;
         $res = $ilDB->query($query);
         return $res->numRows() ? true : false;
     }
     if (!array_intersect($local_roles, $user_roles)) {
         return false;
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:36,代码来源:class.ilObjGroup.php

示例5: _deleteAllChildMetaData

 /**
  *	Delete meta data of a content object (pages, chapters)
  *   @access    public
  *	@param array of child ids
  *	@see _getAllChildIds()
  *	@return boolean
  */
 function _deleteAllChildMetaData($a_ids)
 {
     global $ilBench, $ilDB;
     #$ilBench->start('NestedSet','deleteAllChildMetaData');
     // STEP TWO: DELETE ENTRIES IN xmlnestedset GET ALL tag_fks
     $in = " IN (";
     $in .= implode(",", ilUtil::quoteArray($a_ids));
     $in .= ")";
     $query = "SELECT ns_tag_fk FROM xmlnestedset " . "WHERE ns_book_fk " . $in;
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $tag_fks[$row->ns_tag_fk] = $row->ns_tag_fk;
     }
     $ilDB->query("DELETE FROM xmlnestedset WHERE ns_book_fk " . $in);
     // FINALLY DELETE
     $in = " IN (";
     $in .= implode(",", ilUtil::quoteArray($tag_fks));
     $in .= ")";
     $ilDB->query("DELETE FROM xmlparam WHERE tag_fk " . $in);
     $ilDB->query("DELETE FROM xmlvalue WHERE tag_fk " . $in);
     $ilDB->query("DELETE FROM xmltags  WHERE tag_pk " . $in);
     #$ilBench->stop('NestedSet','deleteAllChildMetaData');
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:31,代码来源:class.ilNestedSetXML.php


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