} while ($row = mysql_fetch_array($result, MYSQL_NUM)) { if ($ccc >= 1 + $recordsPerPage * ($pp - 1) and $ccc <= $recordsPerPage * $pp) { $all[$ccc] = $row; $all[$ccc][4] = $ccc; } $ccc++; } // deg($all); $paginator = new Paginator($count); $paginator->setRecordsPerPage($recordsPerPage); $paginator->setCurrentPage($pp); $append .= " LIMIT " . $paginator->getLimit(); $_SESSION['admin_filters_stats']['filters']['count'] = $count; $templates = new Templates(); $templates_list = $templates->getAll(); // deg($templates_list); if (!$default_show) { $template_names_by_hash = array(); foreach ($templates_list as $s) { $template_names_by_hash[$s->hash] = $s->name; } $smarty->assign('template_names_by_hash', $template_names_by_hash); // deg($template_names_by_hash); } $smarty->assign('templateClass', $templates); $smarty->assign('templates', $templates_list); $smarty->assign('paginatorHtml', $paginator->getHtml()); $smarty->assign('paginator', $paginator); $smarty->assign('filters', $filters); $smarty->assign('arr', $all);
$filters['start_date'] = $min_date; } if (empty($_SESSION['admin_filters_quizz']['filters']['end_date'])) { $_SESSION['admin_filters_quizz']['filters']['end_date'] = date("Y-m-d"); $filters['end_date'] = date("Y-m-d"); } $smarty = Application::getSmarty('/admin/templates/', '/admin/templates_c/'); $smarty->assign($filters); $res = array(); $res_all = array(); $max = array(); // ------------------- start query $query = " SELECT `templates`.`name` , `templates`.`id` , `notifications`.`type`"; $initial = 2; $templates = new Templates(); $tpls = $templates->getAll(); if (!empty($filters['type_editable'])) { if ($initial > 0) { $query .= ", "; } else { $initial++; } $query .= " sum( `notifications`.`status` = 'EDITABLE') as `type_editable` "; } if (!empty($filters['type_published_free'])) { if ($initial > 0) { $query .= ", "; } else { $initial++; } $query .= " sum( `notifications`.`status`='PUBLISHED' AND NOT (`notifications`.`flags` & " . Notify::FLAG_PREMIUM . ")) as `type_published_free` ";
//$append .= " AND flags & " . Notify::FLAG_NOTIF_DATA_SAVED; $orderAlbums = isset($_SESSION['admin_filters_quizz']['order']) ? $_SESSION['admin_filters_quizz']['order'] : null; if (isset($orderAlbums->orderBy)) { $append .= ' ORDER BY `' . $orderAlbums->orderBy . '` ' . $orderAlbums->orderType . ' '; } else { $append .= ' ORDER BY `id` DESC '; } $recordsPerPage = isset($filters['records']) ? intval($filters['records']) : 10; if ($recordsPerPage < 10 || $recordsPerPage > 500) { $recordsPerPage = 10; } $album = new Notify(); $count = $album->getCount($append); $templates = new Templates(); $paginator = new Paginator($count); $paginator->setRecordsPerPage($recordsPerPage); $append .= " LIMIT " . $paginator->getLimit(); $filters['order'] = $orderAlbums; $smarty->assign('paginatorHtml', $paginator->getHtml()); $smarty->assign('paginator', $paginator); $smarty->assign('notifications', Notify::getNotificationsListAdmin($append)); $smarty->assign('filters', $filters); if (!isset($arr)) { $arr[] = ''; } $smarty->assign('arr_template', $arr); $smarty->assign('templates', $templates->getAll(' order by name ')); $smarty->assign('quizTypes', Notify::getTypes()); $smarty->assign($_SESSION['admin_filters_quizz']['filters'], $_SESSION['admin_filters_quizz']['filters']); $smarty->assign('filter_chart_period', $_SESSION['admin_filters_quizz']['filters']['filter_chart_period']); $smarty->assign('filter_chart_y_axis', $_SESSION['admin_filters_quizz']['filters']['filter_chart_y_axis']);
<?php $smarty->assign('action', $action); $id = isset($_GET['id']) ? intval($_GET['id']) : null; $template = new Templates($id); switch ($action) { case 'list': default: $type = isset($_GET['type']) ? $_GET['type'] : null; $obj = new Templates(); $append = ""; if (!empty($type)) { $append = "WHERE type = '" . realEscapeString($type) . "' "; } $smarty->assign('obj', $obj->getAll($append . " ORDER BY `display_order` ")); $smarty->assign('CONTENT', 'templates/list.tpl'); $smarty->assign('type', $type); break; case 'status': if (!isset($_GET['id'])) { jump('index.php?page=templates'); } $obj = new Templates((int) $_GET['id']); $obj->status = $obj->status == 0 ? 1 : 0; $obj->save(); Messages::addNotice('Status changed'); jump('index.php?page=templates'); break; case 'default': if (!isset($_GET['id'])) { jump('index.php?page=templates');