本文整理汇总了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);
}
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}