本文整理汇总了PHP中Report::FetchBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::FetchBy方法的具体用法?PHP Report::FetchBy怎么用?PHP Report::FetchBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::FetchBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
public static function Delete($id)
{
global $db_connection;
global $link_to_report_images;
global $link_to_report_files;
global $link_to_logo;
$ob = Report::FetchBy(['select_list' => 'id, author_id', 'eq_conds' => ['id' => $id], 'is_unique' => true]);
if (Error::IsError($ob)) {
return $ob;
}
if (!$db_connection->query("DELETE FROM `" . self::$table . "` WHERE `id` = " . $id)) {
echo $db_connection->error;
return 0;
} else {
removeDirectory($link_to_report_images . $id);
removeDirectory($link_to_report_files . $id);
$sended = User::FetchBy(['select_list' => 'sended_reports', 'eq_conds' => ['id' => $ob->GetAuthorID()], 'is_unique' => true]);
$new_sended = [];
foreach ($sended->GetSendedReports() as $key => $repid) {
if ($repid != $id) {
array_push($new_sended, $repid);
}
}
$rc = $db_connection->query('UPDATE ' . User::$table . ' SET sended_reports = "' . $db_connection->real_escape_string(json_encode($new_sended)) . '" WHERE id = ' . $ob->GetAuthorID());
if (!$rc) {
return new Error($db_connection->error, Error::db_error);
}
$received = User::FetchBy(['select_list' => 'received_reports, id', 'where_addition' => '(received_reports LIKE ("%\\"' . $id . '\\"%"))']);
if (Error::IsError($received)) {
return $received;
}
foreach ($received as $key => $user) {
$new_received = [];
foreach ($user->GetReceivedReports() as $key => $repid) {
if ($repid != $id) {
array_push($new_received, $repid);
}
}
$rc = $db_connection->query('UPDATE ' . User::$table . ' SET received_reports = "' . $db_connection->real_escape_string(json_encode($new_received)) . '" WHERE id = ' . $user->GetID());
if (!$rc) {
return new Error($db_connection->error, Error::db_error);
}
}
return 0;
}
}
示例2: DialogInputsYesNo
$content .= 'allowedContent: true, });';
$content .= 'CKEDITOR.config.height = 400;';
$content .= '</script>';
$content .= '<div class="row">';
$content .= DialogInputsYesNo('edit', $_POST['type'], $ob_id, Language::Word('save'), Language::Word('cancel'));
$content .= '</div>';
$content .= '</form>';
$title = Language::Word('report editing');
$header = $title;
}
} else {
if (!isset($_REQUEST['id'])) {
echo 'user id is unset';
exit;
}
$ob = Report::FetchBy(['eq_conds' => ['id' => $_REQUEST['id']], 'is_unique' => true]);
$user_id = GetUserID();
$user = User::FetchBy(['eq_conds' => ['id' => $user_id], 'is_unique' => true, 'select_list' => 'received_reports']);
if ($user_id !== $ob->GetAuthorID() && !in_array($ob->GetID(), $user->GetReceivedReports()) && GetUserPrivileges() !== admin_user_id) {
$content = AlertMessage('alert-danger', Language::Word('access denied'));
} else {
$title = '';
$header = '';
$content = '';
$title = Language::Word('report');
$header = htmlspecialchars($ob->GetName());
$content = $ob->ToHTMLAutoFull(GetUserPrivileges());
}
}
}
include_once $link_to_admin_template;
示例3: ToPageHeader
if ($content_type === 'sended_reps') {
$target = $sended;
}
}
$limit = $to - $from + 1;
if ($content_type != 'all_reps') {
$ids = '';
for ($i = 0, $cnt = count($target); $i < $cnt; ++$i) {
$ids .= '(id = ' . $target[$i] . ')';
if ($i < $cnt - 1) {
$ids .= ' OR';
}
}
$reports = Report::FetchBy(['where_addition' => $ids, 'limit' => $limit, 'offset' => $from, 'order_by' => 'id DESC']);
} else {
$reports = Report::FetchBy(['limit' => $limit, 'offset' => $from, 'order_by' => 'id DESC']);
}
for ($i = 0; $i < $limit; ++$i) {
$content .= $reports[$i]->ToHTMLAutoShortForTable(GetUserPrivileges());
}
$content .= '</tbody>';
$content .= '</table>';
$content .= '</div>';
$content .= '</div>';
require $link_to_pagination_show_template;
$content .= $pagination;
} else {
$content .= ToPageHeader(Language::Word('absense'), "h3", "black");
}
default:
break;