本文整理汇总了PHP中CRequest类的典型用法代码示例。如果您正苦于以下问题:PHP CRequest类的具体用法?PHP CRequest怎么用?PHP CRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionDelete
public function actionDelete()
{
$event = CGrantManager::getEvent(CRequest::getInt("id"));
$id = $event->grant_id;
$event->remove();
$this->redirect("index.php?action=edit&id=" . $id);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CGrantEventsController.class.php
示例2: actionChangeAuthors
public function actionChangeAuthors()
{
$field = CCoreObjectsManager::getCoreModelField(CRequest::getInt("id"));
$field->is_authors = 1 - $field->is_authors;
$field->save();
echo $field->is_authors;
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CCoreModelFieldsController.class.php
示例3: actionGetViewData
public function actionGetViewData()
{
$result = array();
// комиссии по защите дипломов. показываем только комиссии этого года
foreach (CActiveRecordProvider::getWithCondition(TABLE_SAB_COMMISSIONS, "year_id=" . CUtils::getCurrentYear()->getId())->getItems() as $ar) {
$comm = new CSABCommission($ar);
$value = $comm->title;
if (!is_null($comm->manager)) {
$value .= " " . $comm->manager->getName();
}
if (!is_null($comm->secretar)) {
$value .= " (" . $comm->secretar->getName() . ")";
}
$diplom = CStaffManager::getDiplom(CRequest::getInt("diplom_id"));
if (!is_null($diplom)) {
$cnt = 0;
foreach ($comm->diploms->getItems() as $d) {
if (strtotime($diplom->date_act) == strtotime($d->date_act)) {
$cnt++;
}
}
$value .= " " . $cnt;
}
$result[$comm->getId()] = $value;
}
return $result;
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:27,代码来源:CSearchCatalogSABCommission.class.php
示例4: display
public function display($templateName = '', $isCache = false, $num = '')
{
if (empty($templateName)) {
$templateName = CRequest::getController() . '/' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
}
parent::display($templateName, $isCache, $num);
}
开发者ID:seiven,项目名称:ACEAdminForMyframework,代码行数:7,代码来源:BaseController.php
示例5: createUrl
/**
* 创建URL
*/
protected function createUrl($a, $c, $params = array())
{
// 将参数合并传给请求类生成URL
$params['c'] = $c;
$params['a'] = $a;
return CRequest::createUrl($params);
}
开发者ID:seiven,项目名称:ACEAdminForMyframework,代码行数:10,代码来源:CController.php
示例6: checkRight
/**
* 是否有权限
*/
public static function checkRight($thisRoute = null)
{
// 用户资源
$userData = CSession::get('user');
if ($userData['groupId'] == 1) {
return true;
}
$userRightList = isset($userData['rightAll']) ? $userData['rightAll'] : array();
// 附加公共资源
array_push($userRightList, 'system@welcome');
array_push($userRightList, 'system@navList');
array_push($userRightList, 'system@addNav');
array_push($userRightList, 'system@addNavHandle');
array_push($userRightList, 'system@ajaxAddNav');
array_push($userRightList, 'system@editNav');
array_push($userRightList, 'system@editNavHandle');
array_push($userRightList, 'system@delNav');
array_push($userRightList, 'system@changeMyPassword');
array_push($userRightList, 'system@changeMyPassHandle');
array_push($userRightList, 'adminRole@messageCenterForClient');
array_push($userRightList, 'system@seeHelp');
// 转小写
foreach ($userRightList as $key => $val) {
$userRightList[$key] = strtolower($val);
}
// 获取当前请求的路由
if ($thisRoute == null) {
$route = CRequest::getController() . '@' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
} else {
$route = $thisRoute;
}
return in_array(strtolower($route), $userRightList);
}
开发者ID:seiven,项目名称:ACEAdminForMyframework,代码行数:36,代码来源:AdminController.php
示例7: 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);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:38,代码来源:CJsonController.class.php
示例8: execute
public function execute($contextObject)
{
$result = array();
$studyLoad = new CArrayList();
$load = CIndPlanManager::getLoad(CRequest::getInt("planId"));
$studyLoad = $load->getWorksByType(6);
foreach ($studyLoad->getItems() as $row) {
$dataRow = array();
$dataRow[0] = count($result) + 1;
$dataRow[1] = $row->change_section;
$dataRow[2] = $row->change_reason;
$dataRow[3] = "";
$dataRow[4] = $row->change_add_date;
$dataRow[5] = $row->isExecuted();
$result[] = $dataRow;
}
for ($i = count($result); $i <= 7; $i++) {
$row = array();
for ($j = 0; $j <= 5; $j++) {
$row[$j] = "";
}
$result[] = $row;
}
return $result;
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CIndPlanChangesLoad.class.php
示例9: actionSave
public function actionSave()
{
$quest = new CQuestion();
$quest->setAttributes(CRequest::getArray($quest::getClassName()));
if ($quest->validate()) {
if (!CSession::isAuth()) {
$user = "";
} else {
$user = CStaffManager::getUser(CSession::getCurrentUser()->getId())->getName();
}
$quest->contact_info .= " " . $user . '; ip ' . $_SERVER["REMOTE_ADDR"];
if ($quest->answer_text != '') {
$quest->datetime_answ = date("Y-d-m H:i:s", time());
}
$quest->save();
if ($this->continueEdit()) {
$this->redirect("?action=edit&id=" . $quest->getId());
} else {
$this->redirect(WEB_ROOT);
}
return true;
}
$this->setData("quest", $quest);
$this->renderView("__public/_question_add/edit.tpl");
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CQuestionAddController.class.php
示例10: actionDelete
public function actionDelete()
{
$order = CSABManager::getSABPersonOrder(CRequest::getInt("id"));
$person = $order->person_id;
$order->remove();
$this->redirect("index.php?action=edit&id=" . $person);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CSABOrdersController.class.php
示例11: addCodeToGroups
/**
* Ajout des codes pour les Groups
*
* @return bool
*/
protected function addCodeToGroups()
{
$ds = CSQLDataSource::get("std");
$request = new CRequest();
$request->addSelect(array("group_id", "code", "text"));
$request->addTable("groups_mediboard");
$query = $request->makeSelect();
$groups = $ds->loadList($query);
foreach ($groups as $_group) {
$group_id = $_group["group_id"];
$code = CMbString::makeInitials($_group["text"]);
$query = $ds->prepare("UPDATE `groups_mediboard` SET `code`=?1 WHERE `group_id`= ?2", $code, $group_id);
$ds->exec($query);
}
return true;
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:21,代码来源:setup.php
示例12: actionDel
public function actionDel()
{
$cycle = CCorriculumsManager::getCycle(CRequest::getInt("id"));
$id = $cycle->corriculum_id;
$cycle->remove();
$this->redirect("index.php?action=view&id=" . $id);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CCorriculumCyclesController.class.php
示例13: execute
public function execute($contextObject)
{
$result = array();
$studyLoad = new CArrayList();
$load = CIndPlanManager::getLoad(CRequest::getInt("planId"));
$studyLoad = $load->getWorksByType(2);
foreach ($studyLoad->getItems() as $row) {
$dataRow = array();
$dataRow[0] = count($result) + 1;
$dataRow[1] = $row->getTitle();
$dataRow[2] = $row->plan_amount;
$dataRow[3] = $row->plan_expiration_date;
$dataRow[4] = $row->plan_report_type;
$dataRow[5] = $row->isExecuted();
$dataRow[6] = $row->comment;
$result[] = $dataRow;
}
for ($i = count($result); $i <= 7; $i++) {
$row = array();
for ($j = 0; $j <= 6; $j++) {
$row[$j] = "";
}
$result[] = $row;
}
return $result;
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:26,代码来源:CIndPlanEducLoad.class.php
示例14: setResourceId
/**
* Ресурс
*/
public function setResourceId()
{
$this->getRecord()->setItemValue("resource_id", CRequest::getInt("resource_id"));
if ($this->getType() == "kadri") {
$this->_resource = CStaffManager::getPersonById($this->getResourceId());
}
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:10,代码来源:CResource.class.php
示例15: actionDelete
public function actionDelete()
{
$validator = CCoreObjectsManager::getCoreModelFieldValidator(CRequest::getInt("id"));
$field = $validator->field_id;
$validator->remove();
$this->redirect("fields.php?action=edit&id=" . $field);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CCoreModelFieldValidatorsController.class.php
示例16: actionView
public function actionView()
{
$page = CPageManager::getPage(CRequest::getInt("id"));
if (!is_null($page)) {
$this->setData("page", $page);
$this->renderView("_pages/public.view.tpl");
}
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:8,代码来源:CPublicPagesController.class.php
示例17: actionGetStudentsByGroup
/**
* Получить всех студентов учебной группы
*/
public function actionGetStudentsByGroup()
{
$group = CRequest::getInt("group");
$res = array();
foreach (CStaffManager::getStudentGroup($group)->getStudents()->getItems() as $student) {
$res[$student->getId()] = $student->getName();
}
echo json_encode($res);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CStaffJSONController.class.php
示例18: actionGetQuestionsJSON
public function actionGetQuestionsJSON()
{
$arr = array();
$disc = CTaxonomyManager::getCacheDisciplines()->getItem(CRequest::getInt("id"));
foreach (CSEBQuestionsManager::getQuestionsByDiscipline($disc)->getItems() as $i) {
$arr[] = $i->toArrayForJSON();
}
echo json_encode($arr);
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:9,代码来源:CSEBQuestionsController.class.php
示例19: GetRequest
/**
* 获取请求并处理
*/
public function GetRequest()
{
//处理请求
ob_start();
CRequest::getInstance()->run();
//发送响应
CResponse::getInstance()->send();
ob_end_flush();
}
开发者ID:seiven,项目名称:ACEAdminForMyframework,代码行数:12,代码来源:CApplication.php
示例20: actionGetViewData
public function actionGetViewData()
{
$result = array();
$query = new CQuery();
$query->select("term.id as id, term.name as name")->from(TABLE_WORK_PLAN_COMPETENTIONS . " as competention")->innerJoin(TABLE_TAXONOMY_TERMS . " as term", "term.id = competention.competention_id")->condition("competention.plan_id=" . CRequest::getInt("plan_id") . " AND competention.type=0")->limit(0, 10);
foreach ($query->execute()->getItems() as $item) {
$result[$item["id"]] = $item["name"];
}
return $result;
}
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:10,代码来源:CSearchCatalogWorkPlanCompetentions.class.php
注:本文中的CRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论