本文整理汇总了PHP中CRequest::getFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::getFilter方法的具体用法?PHP CRequest::getFilter怎么用?PHP CRequest::getFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRequest
的用法示例。
在下文中一共展示了CRequest::getFilter方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
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");
}
示例2: actionIndex
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");
}
示例3: actionIndex
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");
}
示例4: actionIndex
public function actionIndex()
{
$selectedYear = null;
$set = new CRecordSet();
$query = new CQuery();
$set->setQuery($query);
$query->select("p.*")->from(TABLE_PERSON . " as p")->order("p.fio asc");
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY || CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY) {
if (is_null(CSession::getCurrentPerson())) {
$query->condition("p.id = 0");
} else {
$query->condition("p.id = " . CSession::getCurrentPerson()->getId());
}
}
// фильтр по году
if (!is_null(CRequest::getFilter("year.id"))) {
$query->innerJoin(TABLE_IND_PLAN_LOADS . " as l", "l.person_id = p.id");
$query->innerJoin(TABLE_YEARS . " as year", "l.year_id = year.id");
$selectedYear = CRequest::getFilter("year.id");
}
$yearsQuery = new CQuery();
$yearsQuery->select("year.*")->from(TABLE_YEARS . " as year")->order("year.name asc");
$years = array();
foreach ($yearsQuery->execute()->getItems() as $ar) {
$year = new CTimeIntervals(new CActiveRecord($ar));
$years[$year->getId()] = $year->name;
}
$persons = new CArrayList();
foreach ($set->getPaginated()->getItems() as $ar) {
$person = new CPerson($ar);
$persons->add($person->getId(), $person);
}
$this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php", "icon" => "actions/edit-undo.png"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_ind_plan_view")));
$this->setData("paginator", $set->getPaginator());
$this->setData("persons", $persons);
$this->setData("years", $years);
$this->setData("selectedYear", $selectedYear);
$this->renderView("_individual_plan/load/index.tpl");
}
示例5: actionIndex
public function actionIndex()
{
$set = new CRecordSet();
$query = new CQuery();
$query->select("st_group.*")->from(TABLE_STUDENT_GROUPS . " as st_group")->condition("st_group.year_id =" . CUtils::getCurrentYear()->id)->order("st_group.name asc");
$set->setQuery($query);
$queryLetter = new CQuery();
$queryLetter->select("st_group.*, UPPER(left(st_group.name,1)) as name, count(*) as cnt")->from(TABLE_STUDENT_GROUPS . " as st_group")->condition("st_group.year_id =" . CUtils::getCurrentYear()->id . " ")->group(1)->order("st_group.name asc");
$resRus = array();
foreach ($queryLetter->execute()->getItems() as $ar) {
$res = new CStudentGroup(new CActiveRecord($ar));
$resRus[$res->id] = $res->name;
}
$resRusLetters = array();
$resRusLetters = array_count_values($resRus);
$firstLet = array(1);
foreach ($resRusLetters as $key => $value) {
$firstLet[] = $key;
}
$letter = $firstLet[CRequest::getInt("getsub")];
$letterId = -1;
if (CRequest::getInt("getsub") > 0 and is_null(CRequest::getFilter("id"))) {
if (CRequest::getInt("getsub") > 0) {
$letterId = CRequest::getInt("getsub");
}
$query->condition('st_group.name like "' . $letter . '%" and st_group.year_id =' . CUtils::getCurrentYear()->id);
}
$groups = new CArrayList();
foreach ($set->getPaginated()->getItems() as $item) {
$group = new CStudentGroup($item);
$groups->add($group->getId(), $group);
}
$this->setData("resRusLetters", $resRusLetters);
$this->setData("letterId", $letterId);
$this->setData("firstLet", $firstLet);
$this->setData("groups", $groups);
$this->setData("paginator", $set->getPaginator());
$this->renderView("__public/_student_groups/index.tpl");
}
示例6: actionIndex
public function actionIndex()
{
$set = new CRecordSet(false);
$query = new CQuery();
$set->setQuery($query);
$query->select("com.*")->from(TABLE_SAB_COMMISSIONS . " as com")->order("com.year_id desc, com.id desc");
$showAll = true;
if (is_null(CRequest::getFilter("showall"))) {
$query->condition("year_id = " . CUtils::getCurrentYear()->getId());
$showAll = false;
}
$items = new CArrayList();
foreach ($set->getPaginated()->getItems() as $ar) {
$commission = new CSABCommission($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"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_state_attestation_group")));
$this->renderView("_state_attestation/index.tpl");
}
示例7: actionEditFile
public function actionEditFile()
{
$file = CLibraryManager::getFile(CRequest::getInt("id_file"));
if (!is_null(CRequest::getFilter("author"))) {
$author = CRequest::getFilter("author");
} else {
$author = CSession::getCurrentUser()->getId();
}
$this->addActionsMenuItem(array(array("title" => "Назад", "link" => WEB_ROOT . "_modules/_library/index.php?action=viewFiles&id=" . $file->nameFolder . "&filter=author:" . $author, "icon" => "actions/edit-undo.png")));
$this->setData("file", $file);
$this->renderView("_library/editFile.tpl");
}
示例8: actionIndex
public function actionIndex()
{
$set = new CRecordSet(false);
$query = new CQuery();
$currentCommission = null;
$currentGroup = null;
$isArchive = CRequest::getString("isArchive") == "1";
$query->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->order("preview.date_preview desc");
$set->setQuery($query);
$commQuery = new CQuery();
$commQuery->select("comm.*")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm")->order("comm.name asc")->innerJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "comm.id = preview.comm_id");
if (!$isArchive) {
$commQuery->condition('preview.date_preview between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
}
$groupsQuery = new CQuery();
$groupsQuery->select("stgroup.*")->from(TABLE_STUDENT_GROUPS . " as stgroup")->order("stgroup.name asc")->innerJoin(TABLE_STUDENTS . " as student", "stgroup.id = student.group_id")->innerJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "student.id = preview.student_id");
if (!$isArchive) {
$groupsQuery->condition('preview.date_preview between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
}
if (CRequest::getString("order") == "student.fio") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id=student.id");
$query->order("student.fio " . $direction);
} elseif (CRequest::getString("order") == "st_group.name") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id=student.id");
$query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id");
$query->order("st_group.name " . $direction);
} elseif (CRequest::getString("order") == "diplom.dipl_name") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_DIPLOMS . " as diplom", "diplom.student_id = preview.student_id");
$query->order("diplom.dipl_name " . $direction);
} elseif (CRequest::getString("order") == "diplom_percent") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("diplom_percent " . $direction);
} elseif (CRequest::getString("order") == "another_view") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("another_view " . $direction);
} elseif (CRequest::getString("order") == "person.fio") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_DIPLOMS . " as diplom", "diplom.student_id = preview.student_id");
$query->leftJoin(TABLE_PERSON . " as person", "person.id = diplom.recenz_id");
$query->order("person.fio " . $direction);
} elseif (CRequest::getString("order") == "date_preview") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("date_preview " . $direction);
} elseif (CRequest::getString("order") == "comm.name") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id");
$query->order("comm.name " . $direction);
} elseif (CRequest::getString("order") == "comment") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("comment " . $direction);
}
// фильтр по комисии
if (!is_null(CRequest::getFilter("commission"))) {
$query->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id and comm.id = " . CRequest::getFilter("commission"));
$currentCommission = CRequest::getFilter("commission");
// фильтруем еще и группы
$groupsQuery->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id and comm.id = " . CRequest::getFilter("commission"));
}
// фильтр по группе
if (!is_null(CRequest::getFilter("group"))) {
$arr = explode(",", CRequest::getFilter("group"));
foreach ($arr as $key => $value) {
$arrs[] = 'st_group.id = ' . $value;
}
$currentGroup = CRequest::getFilter("group");
$query->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id=student.id");
$query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
$commQuery->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id = student.id");
$commQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
}
//.........这里部分代码省略.........
示例9: actionIndex
public function actionIndex()
{
/**
$set = CActiveRecordProvider::getAllFromTable(TABLE_PRINT_FIELDS);
$fields = new CArrayList();
foreach ($set->getPaginated()->getItems() as $item) {
$field = CPrintManager::getField($item->getId());
$fields->add($field->getId(), $field);
}
*/
$set = new CRecordSet(false);
$query = new CQuery();
$set->setQuery($query);
$query->select("field.*")->from(TABLE_PRINT_FIELDS . " as field");
/**
* Запрос на набор описателей
*/
$queryFormset = new CQuery();
$queryFormset->select("formset.*")->from(TABLE_PRINT_FORMSETS . " as formset")->order("formset.title asc");
/**
* Текущий выбранный описатель
*/
$selectedField = null;
$selectedFormset = null;
/**
* Фильтры
* ---
* Конкретный выбранный описатель
*/
if (!is_null(CRequest::getFilter("field"))) {
$query->condition("field.id = " . CRequest::getFilter("field"));
$selectedField = CPrintManager::getField(CRequest::getFilter("field"));
$queryFormset->condition("formset.id = " . $selectedField->formset_id);
}
/**
* Набор шаблонов
*/
if (!is_null(CRequest::getFilter("formset"))) {
$query->condition("field.formset_id = " . CRequest::getFilter("formset"));
$selectedFormset = CPrintManager::getFormset(CRequest::getFilter("formset"))->getId();
}
/**
* Набираем выборку
*/
$fields = new CArrayList();
foreach ($set->getPaginated()->getItems() as $ar) {
$field = new CPrintField($ar);
$fields->add($field->getId(), $field);
}
/**
* Наборы описателей
*/
$formsets = array();
foreach ($queryFormset->execute()->getItems() as $item) {
$formsets[$item["id"]] = $item["title"];
}
$this->setData("fields", $fields);
$this->setData("formsets", $formsets);
$this->setData("selectedFormset", $selectedFormset);
$this->setData("selectedField", $selectedField);
$this->setData("paginator", $set->getPaginator());
$this->renderView("_print/field/index.tpl");
}
示例10: actionIndex
public function actionIndex()
{
if (CSettingsManager::getSettingValue("hide_person_data_rule")) {
$set = new CRecordSet();
$query = new CQuery();
$query->select("users.*")->from(TABLE_USERS . " as users")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("userGroup.group_id=1")->order("users.FIO asc");
$queryLetter = new CQuery();
$queryLetter->select("users.*, UPPER(left(users.FIO,1)) as name, count(*) as cnt")->from(TABLE_USERS . " as users")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("userGroup.group_id=1 ")->group(1)->order("users.FIO asc");
$resRus = array();
foreach ($queryLetter->execute()->getItems() as $ar) {
$res = new CLecturerOuter(new CActiveRecord($ar));
$resRus[$res->id] = $res->name;
}
$resRusLetters = array();
$resRusLetters = array_count_values($resRus);
$firstLet = array(1);
foreach ($resRusLetters as $key => $value) {
$firstLet[] = $key;
}
$letter = $firstLet[CRequest::getInt("getsub")];
$letterId = -1;
if (CRequest::getInt("getsub") > 0 and is_null(CRequest::getFilter("user.id"))) {
if (CRequest::getInt("getsub") > 0) {
$letterId = CRequest::getInt("getsub");
}
$query->condition('users.FIO like "' . $letter . '%" and userGroup.group_id=1');
}
$lects = new CArrayList();
$set->setQuery($query);
foreach ($set->getPaginated()->getItems() as $ar) {
$lect = new CLecturerOuter($ar);
$lects->add($lect->getId(), $lect);
}
} else {
$set = new CRecordSet();
$query = new CQuery();
$query->select("person.*")->from(TABLE_PERSON . " as person")->innerJoin(TABLE_USERS . " as users", "users.kadri_id=person.id")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("userGroup.group_id=1")->order("person.fio asc");
$queryLetter = new CQuery();
$queryLetter->select("person.*, UPPER(left(person.fio,1)) as name, count(*) as cnt")->from(TABLE_PERSON . " as person")->innerJoin(TABLE_USERS . " as users", "users.kadri_id=person.id")->innerJoin(TABLE_USER_IN_GROUPS . " as userGroup", "userGroup.user_id=users.id")->condition("userGroup.group_id=1 ")->group(1)->order("person.fio asc");
$resRus = array();
foreach ($queryLetter->execute()->getItems() as $ar) {
$res = new CPerson(new CActiveRecord($ar));
$resRus[$res->id] = $res->name;
}
$resRusLetters = array();
$resRusLetters = array_count_values($resRus);
$firstLet = array(1);
foreach ($resRusLetters as $key => $value) {
$firstLet[] = $key;
}
$letter = $firstLet[CRequest::getInt("getsub")];
$letterId = -1;
if (CRequest::getInt("getsub") > 0 and is_null(CRequest::getFilter("person.id"))) {
if (CRequest::getInt("getsub") > 0) {
$letterId = CRequest::getInt("getsub");
}
$query->condition('person.fio like "' . $letter . '%" and userGroup.group_id=1');
}
if (CSession::isAuth() and (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_ALL)) {
$this->addActionsMenuItem(array(array("title" => "Добавить биографию", "link" => WEB_ROOT . "_modules/_biography/index.php", "icon" => "actions/list-add.png")));
}
$lects = new CArrayList();
$set->setQuery($query);
foreach ($set->getPaginated()->getItems() as $ar) {
$lect = new CPerson($ar);
$lects->add($lect->getId(), $lect);
}
}
$this->setData("resRusLetters", $resRusLetters);
$this->setData("letterId", $letterId);
$this->setData("firstLet", $firstLet);
$this->setData("paginator", $set->getPaginator());
$this->setData("lects", $lects);
$this->renderView("__public/_lecturers/index.tpl");
}
示例11: actionIndex
public function actionIndex()
{
$set = new CRecordSet(false);
$query = new CQuery();
$selectedPerson = null;
$query->select("disser.*")->from(TABLE_PERSON_DISSER . " as disser")->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id = person.id")->condition("disser.disser_type = 'кандидат'")->order("person.fio asc");
$set->setQuery($query);
if (CRequest::getString("order") == "person.fio") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id = person.id");
$query->order("person.fio " . $direction);
} elseif (CRequest::getString("order") == "science_spec_id") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("science_spec_id " . $direction);
} elseif (CRequest::getString("order") == "study_form_id") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("study_form_id " . $direction);
} elseif (CRequest::getString("order") == "scinceMan") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_PERSON . " as person", "disser.scinceMan = person.id");
$query->order("person.fio " . $direction);
} elseif (CRequest::getString("order") == "tema") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("tema " . $direction);
} elseif (CRequest::getString("order") == "god_zach") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("god_zach " . $direction);
} elseif (CRequest::getString("order") == "date_end") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("date_end " . $direction);
} elseif (CRequest::getString("order") == "comment") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("comment " . $direction);
}
// фильтр по руководителю
if (!is_null(CRequest::getFilter("person"))) {
$query->innerJoin(TABLE_PERSON . " as person", "disser.scinceMan = person.id and person.id = " . CRequest::getFilter("person"));
$selectedPerson = CRequest::getFilter("person");
}
// фильтр по ФИО
if (!is_null(CRequest::getFilter("fio"))) {
$query->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id=person.id and person.id = " . CRequest::getFilter("fio"));
}
// фильтр по теме
if (!is_null(CRequest::getFilter("tema"))) {
$query->condition("disser.id = " . CRequest::getFilter("tema"));
}
// фильтр по комментарию
if (!is_null(CRequest::getFilter("comment"))) {
$query->condition("disser.id = " . CRequest::getFilter("comment"));
}
$isArchive = CRequest::getString("isArchive") == "1";
if (!$isArchive) {
$query->condition('disser.date_end > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '"');
}
if ($isArchive) {
$requestParams = array();
foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) {
if ($key != "isArchive") {
$requestParams[] = $key . "=" . $value;
}
}
$this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png")));
} else {
$requestParams = array();
foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) {
$requestParams[] = $key . "=" . $value;
}
$requestParams[] = "isArchive=1";
$this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png")));
}
$managersQuery = new CQuery();
$managersQuery->select("person.*")->from(TABLE_PERSON . " as person")->order("person.fio asc")->innerJoin(TABLE_PERSON_DISSER . " as disser", "person.id = disser.scinceMan");
$managers = array();
foreach ($managersQuery->execute()->getItems() as $ar) {
$person = new CPerson(new CActiveRecord($ar));
//.........这里部分代码省略.........
示例12: actionIndex
public function actionIndex()
{
$set = new CRecordSet(false);
$query = new CQuery();
$selectedUser = null;
$query->select("quest.*")->from(TABLE_QUESTION_TO_USERS . " as quest")->order("quest.datetime_quest desc")->condition("quest.status=5");
$set->setQuery($query);
$showAll = false;
if (CRequest::getString("order") == "quest.user_id") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->innerJoin(TABLE_USERS . " as user", "quest.user_id = user.id");
$query->order("user.fio " . $direction);
} elseif (CRequest::getString("order") == "datetime_quest") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("datetime_quest " . $direction);
} elseif (CRequest::getString("order") == "datetime_answ") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("datetime_answ " . $direction);
} elseif (CRequest::getString("order") == "question_text") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("question_text " . $direction);
} elseif (CRequest::getString("order") == "contact_info") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("contact_info " . $direction);
} elseif (CRequest::getString("order") == "st.name") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->leftJoin(TABLE_QUESTION_STATUS . " as st", "quest.status = st.id");
$query->order("st.name " . $direction);
} elseif (CRequest::getString("order") == "answer_text") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("answer_text " . $direction);
}
// фильтр по пользователю
if (!is_null(CRequest::getFilter("user"))) {
$query->innerJoin(TABLE_USERS . " as user", "quest.user_id = user.id and user.id = " . CRequest::getFilter("user"));
$selectedUser = CRequest::getFilter("user");
}
// фильтр по вопросу
if (!is_null(CRequest::getFilter("question"))) {
$query->condition("quest.id = " . CRequest::getFilter("question"));
}
// фильтр по ответу
if (!is_null(CRequest::getFilter("answer"))) {
$query->condition("quest.id = " . CRequest::getFilter("answer"));
}
// фильтр по контактам
if (!is_null(CRequest::getFilter("contact"))) {
$query->condition("quest.id = " . CRequest::getFilter("contact"));
}
$quests = new CArrayList();
$isArchive = CRequest::getString("isArchive") == "1";
if (!$isArchive) {
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
$query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5');
} else {
$query->condition('(quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5');
}
} else {
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
$query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and quest.status!=5');
} else {
$query->condition("quest.status!=5");
}
}
if (CRequest::getInt("showAll") == 1) {
if (!$isArchive) {
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
$query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL)');
} else {
$query->condition('quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL');
}
} else {
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
$query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '"');
}
}
$showAll = true;
}
foreach ($set->getPaginated()->getItems() as $ar) {
//.........这里部分代码省略.........
示例13: actionIndex
//.........这里部分代码省略.........
$query->order("foreign_lang " . $direction);
} elseif (CRequest::getString("order") == "protocol_2aspir_id") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("protocol_2aspir_id " . $direction);
} elseif (CRequest::getString("order") == "recenz_id") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("recenz_id " . $direction);
} elseif (CRequest::getString("order") == "study_mark") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("study_mark " . $direction);
} elseif (CRequest::getString("order") == "gak_num") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("gak_num " . $direction);
} elseif (CRequest::getString("order") == "comment") {
$direction = "asc";
if (CRequest::getString("direction") != "") {
$direction = CRequest::getString("direction");
}
$query->order("comment " . $direction);
}
// фильтр по руководителю
if (!is_null(CRequest::getFilter("person"))) {
$query->innerJoin(TABLE_PERSON . " as person", "diplom.kadri_id = person.id and person.id = " . CRequest::getFilter("person"));
$currentPerson = CRequest::getFilter("person");
// фильтруем еще и группы
$groupsQuery->innerJoin(TABLE_PERSON . " as person", "diplom.kadri_id = person.id and person.id = " . CRequest::getFilter("person"));
}
// фильтр по группе
if (!is_null(CRequest::getFilter("group"))) {
$arr = explode(",", CRequest::getFilter("group"));
foreach ($arr as $key => $value) {
$arrs[] = 'st_group.id = ' . $value;
}
$currentGroup = CRequest::getFilter("group");
$query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id");
$query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
$managersQuery->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id = student.id");
$managersQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
}
// фильтр по теме
if (!is_null(CRequest::getFilter("theme"))) {
$query->condition("diplom.id = " . CRequest::getFilter("theme"));
}
// фильтр по студенту
if (!is_null(CRequest::getFilter("student"))) {
$query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id and student.id = " . CRequest::getFilter("student"));
}
// фильтр по степени утверждения
if (!is_null(CRequest::getFilter("confirm"))) {
$query->innerJoin(TABLE_DIPLOM_CONFIRMATIONS . " as confirm", "diplom.diplom_confirm = confirm.id and confirm.id = " . CRequest::getFilter("confirm"));
}
// фильтр по месту практики
if (!is_null(CRequest::getFilter("pract"))) {
$query->condition("diplom.id = " . CRequest::getFilter("pract"));