本文整理汇总了PHP中Docebo::db方法的典型用法代码示例。如果您正苦于以下问题:PHP Docebo::db方法的具体用法?PHP Docebo::db怎么用?PHP Docebo::db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docebo
的用法示例。
在下文中一共展示了Docebo::db方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkResourcePerm
public function checkResourcePerm($res_id, $user_id = false, $course_filter = false)
{
$user_id = empty($user_id) ? Docebo::user()->getIdSt() : $user_id;
$filter = $this->getSearchFilter(false, false, $course_filter, $res_id);
$fields = "COUNT(*) as tot";
$qtxt = "SELECT " . $fields . " FROM %lms_kb_res as kr WHERE " . $filter['where'];
$q = Docebo::db()->query($qtxt);
$row = Docebo::db()->fetch_assoc($q);
return $row['tot'] > 0 ? true : false;
}
示例2: doImport
/**
* Do the import operation. This function reads all row from source and puts
* its on destination
* @return array with input_row_index => error only for rows with error
* in index 0 there are the total processed rows
**/
function doImport()
{
$out = array();
// error list
$dst_cols = $this->destination->get_cols_descripor();
$row = $this->source->get_first_row();
$i = 0;
$open_transaction = false;
while ($row !== FALSE) {
$insrow = array();
for ($index = 0; $index < count($this->import_map); $index++) {
if ($this->import_map[$index] != DOCEBOIMPORT_IGNORE) {
$insrow[$this->import_map[$index]] = $row[$index];
}
}
if ($i == 0) {
Docebo::db()->start_transaction();
$open_transaction = true;
}
foreach ($dst_cols as $col) {
$col_name = isset($col[DOCEBOIMPORT_COLID]) ? $col[DOCEBOIMPORT_COLID] : $col[DOCEBOIMPORT_COLNAME];
if (!isset($insrow[$col_name])) {
$insrow[$col_name] = isset($col[DOCEBOIMPORT_DEFAULT]) ? $col[DOCEBOIMPORT_DEFAULT] : '';
}
}
$this->destination->set_charset($this->source->get_charset());
if (!$this->destination->add_row($insrow)) {
$out[$this->source->get_row_index()] = $this->destination->get_error();
}
if ($i == 100) {
$i = 0;
Docebo::db()->commit();
$open_transaction = false;
} else {
$i++;
}
$row = $this->source->get_next_row();
}
if ($open_transaction) {
Docebo::db()->commit();
}
$out[0] = $this->source->get_row_index() - 1;
return $out;
}