public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("spec.*")->from(TABLE_SPECIALITIES . " as spec")->order("spec.id desc"); $set->setQuery($query); $selectedSpeciality = null; /** * Фильтры */ if (!is_null(CRequest::getFilter("speciality"))) { $query->condition("spec.id = " . CRequest::getFilter("speciality")); $selectedSpeciality = CTaxonomyManager::getSpeciality(CRequest::getFilter("speciality")); } /** * Получаем данные */ $specialities = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $speciality = new CSpeciality($item); $specialities->add($speciality->getId(), $speciality); } /** * Подключаем скрипты */ $this->addJSInclude(JQUERY_UI_JS_PATH); $this->addCSSInclude(JQUERY_UI_CSS_PATH); $this->setData("selectedSpeciality", $selectedSpeciality); $this->setData("specialities", $specialities); $this->setData("paginator", $set->getPaginator()); $this->renderView("_specialities/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $set->setPageSize(10); $query = new CQuery(); $query->select("news.*")->from(TABLE_NEWS . " as news")->order("news.id desc"); $set->setQuery($query); $news = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $newsItem = new CNewsItem($ar); $news->add($newsItem->getId(), $newsItem); } //проверка доступности виджета вконтакте /*$check_url = @get_headers('http://vk.com/js/api/openapi.js'); $cache_vk_id = "vk_access"; if (is_null(CApp::getApp()->cache->get($cache_vk_id))) { $vk = strpos($check_url[0],'200'); CApp::getApp()->cache->set($cache_vk_id, $vk); } $vk_access = CApp::getApp()->cache->get($cache_vk_id); $this->setData("vk_access", $vk_access);*/ $this->setData("news", $news); $this->setData("paginator", $set->getPaginator()); $this->renderView("_news/public.index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("t.*")->from(TABLE_WORK_PLAN_COMPETENTIONS . " as t")->order("t.id asc")->condition("plan_id=" . CRequest::getInt("plan_id") . " AND type=" . CRequest::getInt("type")); $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CWorkPlanCompetention($ar); $objects->add($object->getId(), $object); } $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); /** * Генерация меню */ $this->addActionsMenuItem(array("title" => "Добавить компетенцию", "link" => "workplancompetentions.php?action=add&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/list-add.png")); $this->addActionsMenuItem(array("title" => "Обновить", "link" => "workplancompetentions.php?action=index&plan_id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/view-refresh.png")); $this->addActionsMenuItem(array("title" => "Загрузить из дисциплины", "link" => "workplancompetentions.php?action=update&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/format-indent-more.png")); if (CRequest::getInt("type") == 0) { $this->addActionsMenuItem(array("title" => "Скопировать компетенции из РП в УП", "link" => "workplancompetentions.php?action=copyCompetentions&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/format-indent-less.png")); } $this->addActionsMenuItem(array("title" => "Удалить выделенные", "icon" => "actions/edit-delete.png", "form" => "#MainView", "link" => "workplans.php", "action" => "delete")); /** * Отображение представления */ $this->renderView("_corriculum/_workplan/competentions/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("person.*")->innerJoin(TABLE_STAFF_ORDERS . " as orders", "person.id = orders.kadri_id")->innerJoin(TABLE_PERSON_BY_TYPES . " as type", "person.id = type.kadri_id")->from(TABLE_PERSON . " as person")->order("person.fio asc")->condition("orders.order_active=1"); $PPS = false; if (CRequest::getInt("PPS") == 1) { $query->condition("type.person_type_id=1 and orders.order_active=1"); $PPS = true; } $UVP = false; if (CRequest::getInt("UVP") == 1) { $query->condition("type.person_type_id=3 and orders.order_active=1"); $UVP = true; } $persons = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $person = new CPersonTime($ar); $persons->add($person->getId(), $person); } $this->setData("paginator", $set->getPaginator()); $this->setData("PPS", $PPS); $this->setData("UVP", $UVP); $this->setData("persons", $persons); $this->renderView("_staff/time/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(true, true); $query = new CQuery(); $set->setQuery($query); /** * Исходный запрос */ $query->select("person.*")->from(TABLE_PERSON . " as person")->order("person.fio asc"); /** * Набираем выборку */ $persons = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $person = new CPerson($ar); $persons->add($person->getId(), $person); } $this->setData("paginator", $set->getPaginator()); $this->setData("persons", $persons); /** * Генерация меню */ $this->addActionsMenuItem(array(array("title" => "Добавить сотрудника", "link" => "index.php?action=add", "icon" => "actions/list-add.png"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_person_view"))); /** * Отображение представления */ $this->renderView("_staff/person/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("com.*"); $query->leftJoin(TABLE_DIPLOM_PREVIEW_MEMBERS . " as members", "members.comm_id=com.id")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as com")->order("com.date_act desc"); $showAll = true; if (CRequest::getInt("showAll") != 1) { $query->condition('com.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); $showAll = false; } if (CRequest::getString("order") == "person.fio") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_PERSON . " as person", "com.secretary_id = person.id"); $query->order("person.fio " . $direction); } $items = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $commission = new CDiplomPreviewComission($ar); $items->add($commission->getId(), $commission); } $this->setData("showAll", $showAll); $this->setData("commissions", $items); $this->setData("paginator", $set->getPaginator()); $this->addActionsMenuItem(array(array("title" => "Добавить комиссию", "link" => "?action=add", "icon" => "actions/list-add.png"))); $this->renderView("_diploms/preview_commission/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $set->setQuery($query); $query->select("t.*")->from(TABLE_NMS_PROTOCOL . " as t")->order('STR_TO_DATE(date_text, "%d.%m.%Y") desc'); if (CRequest::getString("order") == "date_text") { $direction = "asc"; if (CRequest::getString("direction") == "desc") { $direction = "desc"; } $query->order('STR_TO_DATE(date_text, "%d.%m.%Y") ' . $direction); } $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CNMSProtocol($ar); $objects->add($object->getId(), $object); } $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); /** * Генерация меню */ $this->addActionsMenuItem(array("title" => "Добавить протокол", "link" => "index.php?action=add", "icon" => "actions/list-add.png")); /** * Отображение представления */ $this->renderView("_protocols_nms/protocol/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $selectedTown = null; $query->select("pract.*")->from(TABLE_PRACTICE_PLACES . " as pract")->order("pract.name asc"); $practics = new CArrayList(); $set->setQuery($query); if (CRequest::getString("order") == "towns.name") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->leftJoin(TABLE_TOWNS . " as towns", "pract.town_id=towns.id"); $query->order("towns.name " . $direction); } elseif (CRequest::getString("order") == "name") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("name " . $direction); } elseif (CRequest::getString("order") == "comment") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("comment " . $direction); } $townQuery = new CQuery(); $townQuery->select("distinct(town.id) as id, town.name as name")->from(TABLE_TOWNS . " as town")->innerJoin(TABLE_PRACTICE_PLACES . " as pract", "pract.town_id = town.id")->order("town.name asc"); // фильтр по городу if (!is_null(CRequest::getFilter("town"))) { $query->innerJoin(TABLE_TOWNS . " as town", "pract.town_id = town.id and town.id = " . CRequest::getFilter("town")); $selectedTown = CRequest::getFilter("town"); } // фильтр по наименованию if (!is_null(CRequest::getFilter("name"))) { $query->condition("pract.id = " . CRequest::getFilter("name")); } // фильтр по комментарию if (!is_null(CRequest::getFilter("comment"))) { $query->condition("pract.id = " . CRequest::getFilter("comment")); } $towns = array(); foreach ($townQuery->execute()->getItems() as $item) { $towns[$item["id"]] = $item["name"]; } foreach ($set->getPaginated()->getItems() as $ar) { $practic = new CPracticePlace($ar); $practics->add($practic->getId(), $practic); } $this->setData("paginator", $set->getPaginator()); $this->setData("practics", $practics); $this->setData("towns", $towns); $this->setData("selectedTown", $selectedTown); $this->renderView("_pract_bases/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $query->select("usatu_order.*")->from(TABLE_USATU_ORDERS . " as usatu_order")->order("usatu_order.id desc"); $set->setQuery($query); /** * Сортировка приказов в различных направлениях */ $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } if (CRequest::getString("order") == "date") { $query->order("usatu_order.date " . $direction); } elseif (CRequest::getString("order") == "number") { $query->order("usatu_order.num " . $direction); } elseif (CRequest::getString("order") == "type") { $query->leftJoin(TABLE_USATU_ORDER_TYPES . " as order_type", "order_type.id = usatu_order.orders_type"); $query->order("order_type.name " . $direction); } elseif (CRequest::getString("order") == "title") { $query->order("usatu_order.title " . $direction); } /** * Фильтрация приказов */ $selectedOrder = null; if (!is_null(CRequest::getFilter("order"))) { $query->condition("usatu_order.id = " . CRequest::getFilter("order")); $selectedOrder = CStaffManager::getUsatuOrder(CRequest::getFilter("order")); } $selectedType = null; if (!is_null(CRequest::getFilter("type"))) { $query->condition("orders_type = " . CRequest::getFilter("type")); $selectedType = CTaxonomyManager::getUsatuOrderType(CRequest::getFilter("type"))->getId(); } /** * Выборка приказов */ $orders = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $order = new COrderUsatu($item); $orders->add($order->getId(), $order); } $this->setData("selectedOrder", $selectedOrder); $this->setData("selectedType", $selectedType); $this->setData("orders", $orders); $this->addJSInclude(JQUERY_UI_JS_PATH); $this->addCSSInclude(JQUERY_UI_CSS_PATH); $this->setData("paginator", $set->getPaginator()); $this->renderView("_orders_usatu/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $personList = array(); $currentPerson = null; $query->select("t.*")->from(TABLE_PUBLICATIONS . " as t")->order("t.id asc"); if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.izdan_id = t.id"); $query->condition("p.kadri_id=" . CSession::getCurrentPerson()->getId()); $currentPerson = CSession::getCurrentPerson()->getId(); $personList[$currentPerson] = CSession::getCurrentPerson()->getName(); } else { $personList = array(); $personQuery = new CQuery(); $personQuery->select("person.id, person.fio")->from(TABLE_PERSON . " as person")->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.kadri_id = person.id")->order("person.fio asc"); foreach ($personQuery->execute()->getItems() as $arr) { $personList[$arr["id"]] = $arr["fio"]; } if (CRequest::getInt("person") != 0) { $currentPerson = CRequest::getInt("person"); $query->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.izdan_id = t.id"); $query->condition("p.kadri_id=" . $currentPerson); } } if (CRequest::getString("order") == "year") { $direction = "asc"; if (CRequest::getString("direction") == "desc") { $direction = "desc"; } $query->order('STR_TO_DATE(year, "%Y") ' . $direction); } $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CPublication($ar); $objects->add($object->getId(), $object); } $this->setData("currentPerson", $currentPerson); $this->setData("personList", $personList); $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); /** * Генерация меню */ $this->addActionsMenuItem(array(array("title" => "Добавить публикацию", "link" => "publications.php?action=add", "icon" => "actions/list-add.png"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_publications"))); /** * Отображение представления */ $this->renderView("_staff/publications/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("r.*")->from(TABLE_RATES . " as r")->order("r.id desc"); $set->setQuery($query); $rates = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $rate = new CRate($ar); $rates->add($rate->getId(), $rate); } $this->setData("rates", $rates); $this->setData("paginator", $set->getPaginator()); $this->renderView("_rates/rate/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("rate.*")->from(TABLE_HOURS_RATE . " as rate")->leftJoin(TABLE_POSTS . " as post", "rate.dolgnost_id = post.id")->order("post.name asc"); $rates = new CArrayList(); $set->setQuery($query); foreach ($set->getPaginated()->getItems() as $ar) { $rate = new CHoursRate($ar); $rates->add($rate->getId(), $rate); } $this->setData("paginator", $set->getPaginator()); $this->setData("rates", $rates); $this->renderView("_hrs_rate/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("m.*")->from(TABLE_CORE_MODELS . " as m"); $models = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $model = new CCoreModel($ar); $models->add($model->getId(), $model); } $this->setData("models", $models); $this->setData("paginator", $set->getPaginator()); $this->renderView("_core/model/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("gr.*")->from(TABLE_USER_GROUPS . " as gr")->order("gr.comment asc"); $groups = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $group = new CUserGroup($ar); $groups->add($group->getId(), $group); } $this->setData("paginator", $set->getPaginator()); $this->setData("groups", $groups); $this->renderView("_users/groups/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("*")->from(TABLE_CORE_VALIDATORS); $items = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $v = new CCoreValidator($ar); $items->add($v->getId(), $v); } $this->setData("validators", $items); $this->setData("paginator", $set->getPaginator()); $this->renderView("_core/validator/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("t.*")->from(TABLE_GRANTS . " as t")->order("t.id asc"); $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CGrant($ar); $objects->add($object->getId(), $object); } $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); $this->renderView("__public/_grants/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("biography.*")->from(TABLE_BIOGRAPHY . " as biography")->condition("biography.user_id = " . CSession::getCurrentUser()->getId()); $biographys = new CArrayList(); $set->setQuery($query); foreach ($set->getPaginated()->getItems() as $ar) { $biography = new CBiography($ar); $biographys->add($biography->getId(), $biography); } $this->setData("paginator", $set->getPaginator()); $this->setData("biographys", $biographys); $this->renderView("_biography/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("user.*")->from(TABLE_USERS . " as user")->order("user.fio asc"); $users = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $user = new CUser($ar); $users->add($user->getId(), $user); } $this->setData("users", $users); $this->setData("paginator", $set->getPaginator()); $this->renderView("_users/users/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("*")->from(TABLE_USER_ROLES . "")->order("name asc"); $tasks = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $task = new CUserRole($ar); $tasks->add($task->getId(), $task); } $this->setData("tasks", $tasks); $this->setData("paginator", $set->getPaginator()); $this->renderView("_users/tasks/index.tpl"); }
public function actionIndex() { $selectedType = null; $set = new CRecordSet(true, true); $query = new CQuery(); $set->setQuery($query); /** * Исходный запрос */ $query->select("person.*")->from(TABLE_PERSON . " as person")->leftJoin(TABLE_PERSON_BY_TYPES . " as types", "types.kadri_id = person.id")->leftJoin(TABLE_TYPES . " as person_types", "types.person_type_id = person_types.id")->leftJoin(TABLE_GENDERS . " as pol", "person.pol = pol.id")->leftJoin(TABLE_TAXONOMY_TERMS . " as term", "person.department_role_id = term.id")->leftJoin(TABLE_LANGUAGES . " as lang", "person.language1 = lang.id")->leftJoin(TABLE_POSTS . " as post", "person.dolgnost = post.id")->leftJoin(TABLE_TITLES . " as zvanie", "person.zvanie = zvanie.id")->leftJoin(TABLE_DEGREES . " as stepen", "person.stepen = stepen.id")->order("person.fio asc"); $isAll = false; if (CRequest::getInt("isAll") == "1") { $isAll = true; } if (CRequest::getInt("type") != 0) { $selectedType = CRequest::getInt("type"); } elseif (!$isAll and is_null(CRequest::getString("filterClass"))) { $query->condition("(types.person_type_id = 1 or types.person_type_id = 3)"); } $typesQuery = new CQuery(); $typesQuery->select("types.*")->from(TABLE_TYPES . " as types")->order("types.name asc"); $types = array(); foreach ($typesQuery->execute()->getItems() as $ar) { $type = new CActiveModel(new CActiveRecord($ar)); $types[$type->getId()] = $type->name; } /** * Набираем выборку */ $persons = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $person = new CPerson($ar); $persons->add($person->getId(), $person); } $this->setData("paginator", $set->getPaginator()); $this->setData("persons", $persons); $this->setData("types", $types); $this->setData("isAll", $isAll); $this->setData("selectedType", $selectedType); /** * Генерация меню */ $this->addActionsMenuItem(array(array("title" => "Добавить сотрудника", "link" => "index.php?action=add", "icon" => "actions/list-add.png"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_person"))); /** * Отображение представления */ $this->renderView("_staff/person/index.tpl"); }
public function actionTypes() { $set = new CRecordSet(); $query = new CQuery(); $query->select("types.*")->from(TABLE_PUBLICATIONS_TYPES . " as types")->order("types.name asc"); $types = new CArrayList(); $set->setQuery($query); foreach ($set->getPaginated()->getItems() as $ar) { $type = new CPublicationByTypes($ar); $types->add($type->getId(), $type); } $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php", "icon" => "actions/edit-undo.png"), array("title" => "Добавить", "link" => "index.php?action=add", "icon" => "actions/list-add.png"))); $this->setData("paginator", $set->getPaginator()); $this->setData("types", $types); $this->renderView("_rating_publications/types.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $set->setPageSize(10); $query = new CQuery(); $query->select("news.*")->from(TABLE_NEWS . " as news")->order("news.id desc"); $set->setQuery($query); $news = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $newsItem = new CNewsItem($ar); $news->add($newsItem->getId(), $newsItem); } $this->setData("news", $news); $this->setData("paginator", $set->getPaginator()); $this->renderView("_news/public.index.tpl"); }
public function actionIndex() { $set = new CRecordSet(true); $query = new CQuery(); $query->select("student.*")->from(TABLE_STUDENTS . " as student")->order("student.id desc"); // выборка финишных данных и их показ пользователю $set->setQuery($query); $students = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $student = new CStudent($item); $students->add($student->getId(), $student); } $this->addActionsMenuItem(array(array("title" => "Добавить студента", "link" => "?action=add", "icon" => "actions/list-add.png"), array("title" => "ВКР", "link" => WEB_ROOT . "_modules/_diploms/index.php", "icon" => "devices/network-wired.png"), array("title" => "Импорт", "link" => "?action=import", "icon" => "actions/document-save.png"), array("title" => "Групповые операции", "link" => "#", "icon" => "apps/utilities-terminal.png", "child" => array(array("title" => "Перенос в другую группу", "icon" => "actions/edit-redo.png", "form" => "#MainView", "link" => "index.php", "action" => "changeGroup"), array("title" => "Удалить выделенные", "icon" => "actions/edit-delete.png", "form" => "#MainView", "link" => "index.php", "action" => "Delete"))))); $this->setData("students", $students); $this->setData("paginator", $set->getPaginator()); $this->renderView("_students/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(true); $query = new CQuery(); $query->select("st_group.*")->from(TABLE_STUDENT_GROUPS . " as st_group")->order("st_group.id desc"); $set->setQuery($query); /** * Финишная выборка */ $groups = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $group = new CStudentGroup($item); $groups->add($group->getId(), $group); } $this->setData("groups", $groups); $this->setData("paginator", $set->getPaginator()); $this->renderView("_student_groups/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("news.*")->from(TABLE_NEWS . " as news")->order("news.id desc"); if (CSession::getCurrentUser()->getStatus() !== USER_TYPE_ADMIN) { $query->condition("news.user_id_insert = " . CSession::getCurrentUser()->getId()); } $set->setQuery($query); $news = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $newsItem = new CNewsItem($ar); $news->add($newsItem->getId(), $newsItem); } $this->setData("paginator", $set->getPaginator()); $this->setData("news", $news); $this->renderView("_news/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(true); $query = new CQuery(); $set->setQuery($query); /** * Исходный запрос */ $query->select("w.*")->from(TABLE_IND_PLAN_WORKTYPES . " as w")->order("w.name asc"); $works = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $work = new CIndPlanWorktype($ar); $works->add($work->getId(), $work); } $this->setData("works", $works); $this->setData("paginator", $set->getPaginator()); $this->renderView("_individual_plan/worktypes/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("corr.*")->from(TABLE_CORRICULUMS . " as corr")->order("corr.id desc"); $set->setQuery($query); $corriculums = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $corriculum = new CCorriculum($item); $corriculums->add($corriculum->getId(), $corriculum); } /** * Передаем данные */ $this->setData("paginator", $set->getPaginator()); $this->setData("corriculums", $corriculums); $this->renderView("_corriculum/_plan/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(true); $query = new CQuery(); $query->select("page.*")->from(TABLE_PAGES . " as page")->order("page.type_id asc"); $pages = new CArrayList(); $set->setQuery($query); if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition("page.user_id_insert = " . CSession::getCurrentUser()->getId()); } foreach ($set->getPaginated()->getItems() as $ar) { $page = new CPage($ar); $pages->add($page->getId(), $page); } $this->setData("paginator", $set->getPaginator()); $this->setData("pages", $pages); $this->renderView("_pages/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("gr.*")->from(TABLE_GRANTS . " as gr")->order("gr.id desc"); if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY || CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->leftJoin(TABLE_GRANT_MEMBERS . " as m", "m.grant_id = gr.id"); $query->condition("gr.author_id=" . CSession::getCurrentPerson()->getId() . " OR m.person_id=" . CSession::getCurrentPerson()->getId() . " or gr.manager_id=" . CSession::getCurrentUser()->getId()); } $set->setQuery($query); $grants = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $grant = new CGrant($ar); $grants->add($grant->getId(), $grant); } $this->setData("grants", $grants); $this->setData("paginator", $set->getPaginator()); $this->renderView("_grants/grant/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("t.*")->from(TABLE_WORK_PLAN_CRITERIA_OF_EVALUATION . " as t")->order("t.id asc")->condition("plan_id=" . CRequest::getInt("plan_id") . " AND type=" . CRequest::getInt("type")); $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CWorkPlanCriteriaOfEvaluation($ar); $objects->add($object->getId(), $object); } $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); /** * Генерация меню */ $this->addActionsMenuItem(array("title" => "Добавить", "link" => "workplancriteriaofevaluation.php?action=add&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/list-add.png")); /** * Отображение представления */ $this->renderView("_corriculum/_workplan/criteriaEvaluation/index.tpl"); }