本文整理汇总了PHP中CRequest::getString方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::getString方法的具体用法?PHP CRequest::getString怎么用?PHP CRequest::getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRequest
的用法示例。
在下文中一共展示了CRequest::getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionWizardCompleted
public function actionWizardCompleted()
{
$sign_date = CRequest::getString("sign_date");
$chairman = CStaffManager::getPersonById(CRequest::getInt("chairman_id"));
$master = CStaffManager::getPersonById(CRequest::getInt("master_id"));
$members = new CArrayList();
foreach (CRequest::getArray("members") as $m) {
$member = CStaffManager::getPersonById($m);
$members->add($member->getId(), $member);
}
CProtocolManager::getAllSebProtocols();
// на студента по протоколу
foreach (CRequest::getArray("student") as $key => $value) {
$student = CStaffManager::getStudent($key);
$ticket = CSEBTicketsManager::getTicket($value['ticket_id']);
$mark = CTaxonomyManager::getMark($value['mark_id']);
$questions = $value['questions'];
$protocol = CFactory::createSebProtocol();
$protocol->setSignDate($sign_date);
$protocol->setStudent($student);
$protocol->setChairman($chairman);
$protocol->setTicket($ticket);
$protocol->setMark($mark);
$protocol->setQuestions($questions);
$protocol->setBoarMaster($master);
$protocol->setSpeciality($student->getSpeciality());
foreach ($members->getItems() as $member) {
$protocol->addMember($member);
}
$protocol->setNumber(CProtocolManager::getAllSebProtocols()->getCount() + 1);
$protocol->save();
CProtocolManager::getCacheSebProtocols()->add($protocol->getId(), $protocol);
}
$this->redirect("?action=index");
}
示例2: actionJSONGet
/**
* Получение данных модели по идентификатору
*/
private function actionJSONGet()
{
// получим название класса модели, которую надо пользователю
$modelClass = CRequest::getString("model");
// идентификатор
$id = CRequest::getInt("id");
// создадим объект, посмотрим, в какой таблице он весь живет
/**
* @var $model CActiveModel
*/
$model = new $modelClass();
// проверим, может не реализует нужный интерфейс
if (!is_a($model, "IJSONSerializable")) {
throw new Exception("Класс " . $modelClass . " не реализует интерфейс IJSONSerializable");
}
$modelTable = $model->getRecord()->getTable();
// получим из этой таблицы объект
$ar = CActiveRecordProvider::getById($modelTable, $id);
if (is_null($ar)) {
echo json_encode(null);
return;
}
// создадим новый объект указанного типа
/**
* @var $model IJSONSerializable
*/
$model = new $modelClass($ar);
// получим json объект модели
$jsonObj = $model->toJsonObject();
// добавим к json-объекту перевод
$jsonObj->_translation = CCoreObjectsManager::getAttributeLabels($model);
// сразу добавим штатную валидацию
// может, чуть позже, пока нет
echo json_encode($jsonObj);
}
示例3: actionIndex
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");
}
示例4: actionAutosave
public function actionAutosave()
{
if (CRequest::getInt("id") !== 0) {
$help = CHelpManager::getHelp(CRequest::getInt("id"));
if (!is_null($help)) {
$help->content = CRequest::getString("content", $help::getClassName());
$help->save();
}
}
}
示例5: __construct
public function __construct()
{
if (!CSession::isAuth()) {
if (!in_array(CRequest::getString("action"), $this->allowedAnonymous)) {
$this->redirectNoAccess();
}
}
$this->_smartyEnabled = true;
$this->setPageTitle("Подсистема архивирования");
parent::__construct();
}
示例6: getCommissions
/**
* @return CArrayList
*/
public static function getCommissions()
{
$res = new CArrayList();
$ids = CRequest::getString("id");
$ids = explode(":", $ids);
foreach ($ids as $id) {
$comm = self::getCommission($id);
if (!is_null($comm)) {
$res->add($comm->getId(), $comm);
}
}
return $res;
}
示例7: actionSave
/**
* Сохранение отправленных данных
*/
public function actionSave()
{
$taxonomy = CTaxonomyManager::getTaxonomy(CRequest::getInt("taxonomy_id"));
$term = CFactory::createTerm();
$term->setTaxonomy($taxonomy);
$term->setValue(CRequest::getString("name"));
$term->setAlias(CRequest::getString("alias"));
if (CRequest::getInt("id") != 0) {
$term->setId(CRequest::getInt("id"));
}
$term->save();
$this->redirect("?action=index&id=" . $taxonomy->getId());
}
示例8: actionSearch
public function actionSearch()
{
$res = array();
$term = CRequest::getString("query");
/**
* Поиск по ФИО сотрудника
*/
$query = new CQuery();
$query->select("distinct(person.id) as id, person.fio as name")->from(TABLE_PERSON . " as person")->condition("person.fio like '%" . $term . "%'")->limit(0, 5);
foreach ($query->execute()->getItems() as $item) {
$res[] = array("field" => "person.id", "value" => $item["id"], "label" => $item["name"], "class" => "CPerson");
}
echo json_encode($res);
}
示例9: actionSearch
public function actionSearch()
{
$res = array();
$term = CRequest::getString("query");
/**
* Ищем группу по названию
*/
$query = new CQuery();
$query->select("st_group.id, st_group.name")->from(TABLE_STUDENT_GROUPS . " as st_group")->condition("LCASE(st_group.name) like '%" . mb_strtolower($term) . "%' and st_group.year_id =" . CUtils::getCurrentYear()->id)->limit(0, 5);
foreach ($query->execute()->getItems() as $item) {
$res[] = array("field" => "id", "value" => $item["id"], "label" => $item["name"], "class" => "CStudentGroup");
}
echo json_encode($res);
}
示例10: actionGetStaffWithRoles
/**
* Массив ключ-значение сотрудников с указанными ролями
*/
public function actionGetStaffWithRoles()
{
// получаем из POST-запроса роли
$res = array();
$roles = new CArrayList();
foreach (explode(",", CRequest::getString("roles")) as $val) {
$roles->add($val, $val);
}
$persons = CStaffManager::getPersonsWithTypes($roles);
foreach ($persons->getItems() as $person) {
$res[$person->getId()] = $person->getName();
}
echo json_encode($res);
}
示例11: actionAjaxUpdate
/**
* Обновление данных об оргструктуре аяксом через
* перетаскивание
*/
public function actionAjaxUpdate()
{
if (!CSession::isAuth()) {
return true;
}
$sourceId = CRequest::getString("source");
$destId = CRequest::getString("destination");
$sourceId = substr($sourceId, strpos($sourceId, "_") + 1);
$destId = substr($destId, strpos($destId, "_") + 1);
$child = CStaffManager::getPersonById($sourceId);
$parent = CStaffManager::getPersonById($destId);
$child->setManager($parent);
$child->save();
$this->renderView(AJAX_VIEW);
}
示例12: __construct
public function __construct()
{
if (!CSession::isAuth()) {
$action = CRequest::getString("action");
if ($action == "") {
$action = "index";
}
if (!in_array($action, $this->allowedAnonymous)) {
$this->redirectNoAccess();
}
}
$this->_smartyEnabled = true;
$this->setPageTitle("Вопросы преподавателям и другим пользователям портала");
parent::__construct();
}
示例13: actionSave
public function actionSave()
{
if (CRequest::getInt("id") == 0) {
$q = CFactory::createSebQuestion();
} else {
$q = CSEBQuestionsManager::getQuestion(CRequest::getInt("id"));
}
$discipline = CTaxonomyManager::getCacheDisciplines()->getItem(CRequest::getInt("discipline_id"));
$speciality = CTaxonomyManager::getCacheSpecialities()->getItem(CRequest::getInt("speciality_id"));
$q->setDiscipline($discipline);
$q->setSpeciality($speciality);
$q->setText(CRequest::getString("question"));
$q->save();
$this->redirect("?action=index");
}
示例14: actionSearch
public function actionSearch()
{
$res = array();
$term = CRequest::getString("query");
/**
* Сначала поищем по названию группы
*/
$query = new CQuery();
$query->select("distinct(page.id) as id, page.title as name")->from(TABLE_PAGES . " as page")->condition("page.title like '%" . $term . "%'")->limit(0, 5);
if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
$query->condition("page.title like '%" . $term . "%' AND page.user_id_insert = " . CSession::getCurrentUser()->getId());
}
foreach ($query->execute()->getItems() as $item) {
$res[] = array("field" => "id", "value" => $item["id"], "label" => $item["name"], "class" => "CPage");
}
echo json_encode($res);
}
示例15: actionSave
/**
* Сохранение меню
*/
public function actionSave()
{
if (!CSession::isAuth()) {
$this->redirectNoAccess();
}
if (CRequest::getInt("id") == 0) {
$menu = CFactory::createMenu();
} else {
$menu = CMenuManager::getMenu(CRequest::getInt("id"));
}
$menu->setName(CRequest::getString("name"));
$menu->setAlias(CRequest::getString("alias"));
$menu->setDescription(CRequest::getString("description"));
$menu->setPublished(CRequest::getInt("published") == 1);
$menu->save();
$this->redirect("?action=index");
}