当前位置: 首页>>代码示例>>PHP>>正文


PHP sfWebRequest::hasParameter方法代码示例

本文整理汇总了PHP中sfWebRequest::hasParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::hasParameter方法的具体用法?PHP sfWebRequest::hasParameter怎么用?PHP sfWebRequest::hasParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWebRequest的用法示例。


在下文中一共展示了sfWebRequest::hasParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     if ($request->hasParameter('object_id') && $request->hasParameter('object_class')) {
         $this->object = Doctrine::getTable($request->getParameter('object_class'))->find($request->getParameter('object_id'));
     }
     $this->setLayout(false);
 }
开发者ID:pierswarmers,项目名称:rtCorePlugin,代码行数:7,代码来源:actions.class.php

示例2: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         // kommt vom multiupload-gedingse
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         $sf_filebase_file = $form->save();
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $sf_filebase_file)));
         if (!$request->hasParameter('swfupload_filesource')) {
             if ($request->hasParameter('_save_and_add')) {
                 $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
                 $this->redirect('@sf_filebase_file_new');
             } else {
                 $this->getUser()->setFlash('notice', $notice);
                 $this->redirect(array('sf_route' => 'sf_filebase_file_edit', 'sf_subject' => $sf_filebase_file));
             }
         }
         return true;
     } else {
         if (!$request->hasParameter('swfupload_filesource')) {
             $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
         }
         return false;
     }
 }
开发者ID:joshiausdemwald,项目名称:sfFilebasePlugin,代码行数:25,代码来源:actions.class.php

示例3: executeSave

 public function executeSave(sfWebRequest $request)
 {
     if ($request->hasParameter('w3s_sm_source') && $request->hasParameter('w3s_sm_dest')) {
         $slotMapperPanel = new w3sSlotMapperPanel($request->getParameter('sourceId'), $request->getParameter('destId'));
         $this->result = $slotMapperPanel->save($request->getParameter('w3s_sm_source'), $request->getParameter('w3s_sm_dest'));
     }
 }
开发者ID:jmp0207,项目名称:w3studiocms,代码行数:7,代码来源:BaseW3sSlotMapperAction.class.php

示例4: executeEncaminhamento

 public function executeEncaminhamento(sfWebRequest $request)
 {
     $this->pager = new sfDoctrinePager('Atendimento', 10);
     if ($request->hasParameter('modo')) {
         if ($request->getParameter('modo') == 'mensal') {
             $start = strtotime(date('Y') . '-' . date('m') . '-01');
             $end = $this->getMonthLastDay();
             $this->datesQueryFormated = $this->getDatesQueryFormated($start, $end);
             $queries = Doctrine_Core::getTable('Atendimento')->getEncaminhamentosBydate($this->datesQueryFormated);
         } elseif ($request->getParameter('modo') == 'semanal') {
             $this->datesQueryFormated = $this->getDatesQueryFormated();
             $queries = Doctrine_Core::getTable('Atendimento')->getEncaminhamentosBydate($this->datesQueryFormated);
         }
     } else {
         if ($request->hasParameter('start') || $request->hasParameter('end')) {
             $start = $request->hasParameter('start') ? $request->getParameter('start') : NULL;
             $end = $request->hasParameter('end') ? $request->getParameter('end') : NULL;
             $this->datesQueryFormated = $this->getDatesQueryFormated($start, $end);
             $queries = Doctrine_Core::getTable('Atendimento')->getEncaminhamentosBydate($this->datesQueryFormated);
         } else {
             $this->datesQueryFormated = $this->getDatesQueryFormated();
             $queries = Doctrine_Core::getTable('Atendimento')->getEncaminhamentosBydate($this->datesQueryFormated);
         }
     }
     $this->pager->setQuery($queries['encaminhamento']);
     $graphData = $queries['chartData']->execute();
     $this->pager->getQuery()->orderBy('created_at DESC');
     $this->pager->setPage($this->getRequestParameter('page', 1));
     $this->pager->init();
     $this->prepareGraphData($graphData);
     $this->pagerURL = $this->preparePagerURL('encaminhamento');
     $this->lstLinks = array("@relatorio_encaminhamento?modo=semanal" => "Semanal", "@relatorio_encaminhamento?modo=mensal" => "Mensal", "@relatorio_historico" => "Voltar");
 }
开发者ID:sindvigti,项目名称:sindhealth,代码行数:33,代码来源:actions.class.php

示例5: executeAdd

 public function executeAdd(sfWebRequest $request)
 {
     //Set the local vars used in this function for easy access.
     $uid_from = $this->getUser()->getAttribute('id');
     $uid_to = $request->getParameter('uid');
     //Error Checking
     $this->errorCheck(!$this->getUser()->hasAttribute('id'), "Required request paramater uid_from is not set.");
     $this->errorCheck(!$request->hasParameter('uid'), "Required request paramater uid is not set.");
     $this->errorCheck($uid_to == null || $uid_to == 0, "Account id can not be null.");
     $this->errorCheck($uid_to == 1, "Friendship requests to the Administrator account are not allowed.");
     $this->errorCheck(!AccountTable::accountExists($uid_from), "Account ({$uid_from}) does not exist in database.");
     $this->errorCheck(!AccountTable::accountExists($uid_to), "Account ({$uid_to}) does not exist in database.");
     $this->errorCheck(FriendTable::areFriends($uid_from, $uid_to), "Account ({$uid_from}) and ({$uid_to}) are already friends.");
     $this->errorCheck(FriendRequestTable::requestPending($uid_from, $uid_to), "Account ({$uid_from}) has already requested ({$uid_to}) for friendship.");
     $this->errorCheck(FriendRequestTable::requestPending($uid_to, $uid_from), "Account ({$uid_to}) has already requested ({$uid_from}) for friendship.");
     $this->errorCheck($uid_from == $uid_to, "Account ({$uid_from}) can not request friendship with itself.");
     //Request is valid if code reaches here so make a friend request object and save it.
     $friendRequest = new FriendRequest();
     $friendRequest->uid_from = $uid_from;
     $friendRequest->uid_to = $uid_to;
     $friendRequest->save();
     $url = "default/index";
     if ($request->hasParameter('redirect_url')) {
         $url = $request->getParameter('redirect_url') . 'index';
     }
     $this->flashAndRedirect("Friendship successfully requested.", $url);
 }
开发者ID:rsanders16,项目名称:NexusPlus,代码行数:27,代码来源:actions.class.php

示例6: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     if ($request->hasParameter('group_id') || $request->hasParameter('nodeid')) {
         $this->setFilters($this->configuration->getFilterDefaults());
     }
     parent::executeIndex($request);
 }
开发者ID:vcgato29,项目名称:poff,代码行数:7,代码来源:actions.class.php

示例7: processFilter

 /**
  * Searches aircrafts by filter
  */
 private function processFilter(sfWebRequest $request)
 {
     $params = $this->getUser()->getAttribute('aircraft', array(), 'aircraft');
     if (!isset($params['make'])) {
         $params['make'] = null;
     }
     if (!isset($params['model'])) {
         $params['model'] = null;
     }
     if (!isset($params['name'])) {
         $params['name'] = null;
     }
     $this->max_array = array(5, 10, 20, 30);
     if (in_array($request->getParameter('max'), $this->max_array)) {
         $params['max'] = $request->getParameter('max');
     } else {
         if (!isset($params['max'])) {
             $params['max'] = sfConfig::get('app_max_person_per_page', 10);
         }
     }
     if ($request->hasParameter('filter')) {
         $params['make'] = $request->getParameter('make');
         $params['model'] = $request->getParameter('model');
         $params['name'] = $request->getParameter('name');
     }
     if ($request->hasParameter('search') && $request->getParameter('search') == 'pilots') {
         $params['name'] = $request->getParameter('name');
     }
     $this->page = $page = $request->getParameter('page', 1);
     $this->max = $params['max'];
     $this->make = $params['make'];
     $this->model = $params['model'];
     $this->name = $params['name'];
     $this->getUser()->setAttribute('aircraft', $params, 'aircraft');
 }
开发者ID:yasirgit,项目名称:afids,代码行数:38,代码来源:actions.class.php

示例8: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     $this->checkProjectsAccess('view');
     if (!$this->getUser()->hasAttribute('projects_filter')) {
         $this->getUser()->setAttribute('projects_filter', Projects::getDefaultFilter($this->getUser()));
     }
     $this->filter_by = $this->getUser()->getAttribute('projects_filter');
     if ($fb = $request->getParameter('filter_by')) {
         $this->filter_by[key($fb)] = current($fb);
         $this->getUser()->setAttribute('projects_filter', $this->filter_by);
         $this->redirect('projects/index');
     }
     if ($request->hasParameter('remove_filter')) {
         unset($this->filter_by[$request->getParameter('remove_filter')]);
         $this->getUser()->setAttribute('projects_filter', $this->filter_by);
         $this->redirect('projects/index');
     }
     if ($request->hasParameter('user_filter')) {
         $this->filter_by = Projects::useProjectsFilter($request->getParameter('user_filter'), $this->getUser());
         $this->getUser()->setAttribute('projects_filter', $this->filter_by);
         $this->redirect('projects/index');
     }
     if ($set_order = $request->getParameter('set_order')) {
         $this->getUser()->setAttribute('projects_listing_order', $set_order);
         $this->redirect('projects/index');
     }
     app::setPageTitle('Projects', $this->getResponse());
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:28,代码来源:actions.class.php

示例9: executeComplete

 /**
  * Tag typeahead AJAX. You might want to secure this action to prevent
  * information discovery in some cases
  *
  */
 public function executeComplete(sfWebRequest $request)
 {
     $this->setLayout(false);
     $current = '';
     if ($request->hasParameter('q')) {
         $current = $request->getParameter('q');
     } elseif ($request->hasParameter('term')) {
         $current = $request->getParameter('term');
     } else {
         $current = $request->getParameter('current');
     }
     $tags = array();
     $tagsInfo = array();
     $tagsAll = array();
     while (preg_match("/^(([\\s\\,]*)([^\\,]+?)(\\s*(\\,|\$)))(.*)\$/", $current, $matches)) {
         list($dummy, $all, $left, $tagName, $right, $dummy, $current) = $matches;
         $tagsInfo[] = array('left' => $left, 'name' => $tagName, 'right' => $right);
         $tagsAll[] = $all;
     }
     $this->tagSuggestions = array();
     $all = '';
     $n = 0;
     $presentOrSuggested = array();
     foreach ($tagsInfo as $tagInfo) {
         $tag = Doctrine_Query::create()->from('Tag t')->where('t.name = ?', $tagInfo['name'])->fetchOne();
         $all .= $tagInfo['left'];
         if ($tag) {
             $presentOrSuggested[$tagInfo['name']] = true;
         } else {
             // $suggestedTags = sfTagtoolsToolkit::getBeginningWith($tagInfo['name']);
             $q = $this->getQuery($tagInfo['name']);
             $suggestedTags = $q->execute();
             foreach ($suggestedTags as $tag) {
                 if (isset($presentOrSuggested[$tag->getName()])) {
                     continue;
                 }
                 // At least some browsers actually submitted the
                 // nonbreaking spaces as ordinals distinct from regular spaces,
                 // producing distinct tags. So leave the spaces alone.
                 // Also, we no longer display 'left' visibly anyway because
                 // that was never compatible with a list of tags that required scrolling
                 $suggestion['left'] = $all;
                 $suggestion['suggested'] = $tag->getName();
                 $presentOrSuggested[$tag->getName()] = true;
                 $suggestion['right'] = $tagInfo['right'] . implode('', array_slice($tagsAll, $n + 1));
                 $this->tagSuggestions[] = $suggestion;
             }
         }
         $all .= $tagInfo['name'];
         $all .= $tagInfo['right'];
         $n++;
     }
     if ($this->hasRequestParameter('q')) {
         $this->setTemplate('jQueryAutocompleteOld');
     } elseif ($this->hasRequestParameter('term')) {
         $this->setTemplate('jQueryAutocomplete');
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:63,代码来源:BasetaggableCompleteActions.class.php

示例10: executeTrust

 public function executeTrust(sfWebRequest $request)
 {
     sfOpenPNEApplicationConfiguration::registerJanRainOpenID();
     require_once 'Auth/OpenID/Server.php';
     require_once 'Auth/OpenID/FileStore.php';
     require_once 'Auth/OpenID/SReg.php';
     require_once 'Auth/OpenID/AX.php';
     $info = unserialize($_SESSION['request']);
     $this->forward404Unless($info);
     $trusted = $request->hasParameter('trust') || $request->hasParameter('permanent');
     if (!$trusted) {
         unset($_SESSION['request']);
         $url = $info->getCancelURL();
         $this->redirect($url);
     }
     $reqUrl = $this->getController()->genUrl('OpenID/member?id=' . $this->getUser()->getMemberId(), true);
     if (!$info->idSelect()) {
         $this->forward404Unless($reqUrl === $info->identity, 'request:' . $reqUrl . '/identity:' . $info->identity);
     }
     unset($_SESSION['request']);
     $server = new Auth_OpenID_Server(new Auth_OpenID_FileStore(sfConfig::get('sf_cache_dir')), $info->identity);
     $response = $info->answer(true, null, $reqUrl);
     $sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($info);
     $axRequest = Auth_OpenID_AX_FetchRequest::fromOpenIDRequest($info);
     $allowedProfiles = $request->getParameter('profiles', array());
     $requiredProfiles = $this->createListOfRequestedProfiles($sregRequest, $axRequest);
     $rejectedProfiles = array_diff_key($requiredProfiles, array_flip($allowedProfiles));
     if (in_array(true, $rejectedProfiles)) {
         $url = $info->getCancelURL();
         $this->redirect($url);
     }
     if ($sregRequest) {
         $sregExchange = new opOpenIDProfileExchange('sreg', $this->getUser()->getMember());
         $sregResp = Auth_OpenID_SRegResponse::extractResponse($sregRequest, $sregExchange->getData($allowedProfiles));
         $response->addExtension($sregResp);
     }
     if ($axRequest && !$axRequest instanceof Auth_OpenID_AX_Error) {
         $axResp = new Auth_OpenID_AX_FetchResponse();
         $axExchange = new opOpenIDProfileExchange('ax', $this->getUser()->getMember());
         $userData = $axExchange->getData($allowedProfiles);
         foreach ($axRequest->requested_attributes as $k => $v) {
             if (!empty($userData[$k])) {
                 $axResp->addValue($k, $userData[$k]);
             }
         }
         $response->addExtension($axResp);
     }
     $log = Doctrine::getTable('OpenIDTrustLog')->log($info->trust_root, $this->getUser()->getMemberId());
     if ($request->hasParameter('permanent')) {
         $log->is_permanent = true;
         $log->save();
     }
     $response = $server->encodeResponse($response);
     return $this->writeResponse($response);
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:55,代码来源:actions.class.php

示例11: executeInsertCategory

 public function executeInsertCategory(sfWebRequest $request)
 {
     if ($request->hasParameter("categoryid") && $request->hasParameter("categoryname")) {
         $parent = Doctrine_Core::getTable('Category')->findOneById($request->getParameter("categoryid"));
         $category = new Category();
         $category->setName($request->getParameter("categoryname"));
         $category->setActive(true);
         $category->getNode()->insertAsLastChildOf($parent);
         return true;
     }
 }
开发者ID:richhl,项目名称:sfCartPlugin,代码行数:11,代码来源:actions.class.php

示例12: executeIcons

 /**
  * Shows assets as icons.
  *
  * @param sfWebRequest $request
  */
 public function executeIcons(sfWebRequest $request)
 {
     if ($request->hasParameter('page')) {
         $this->getUser()->setAttribute('page', $request->getParameter('page'));
     }
     if ($folder_id = $request->getParameter('folder_id')) {
         $this->getUser()->setAttribute('folder_id', $folder_id);
         $this->getUser()->setAttribute('page', 1);
     }
     $folder_id = $this->getUser()->getAttribute('folder_id', 0);
     $this->folder = lyMediaFolderTable::getInstance()->retrieveCurrent($folder_id);
     $this->forward404Unless($this->folder);
     $this->folders = $this->folder->getNode()->getChildren();
     if ($request->hasParameter('sort')) {
         $this->getUser()->setAttribute('sort_field', $request->getParameter('sort'));
     }
     $this->sort_field = $this->getUser()->getAttribute('sort_field', 'name');
     if ($request->hasParameter('dir')) {
         $this->getUser()->setAttribute('sort_dir', $request->getParameter('dir'));
     }
     $this->sort_dir = $this->getUser()->getAttribute('sort_dir');
     if ($request->hasParameter('hide')) {
         $this->getUser()->setAttribute('hide', $request->getParameter('hide') ? 1 : 0);
     }
     $this->hide = $this->getUser()->getAttribute('hide');
     $this->pager = new sfDoctrinePager('lyMediaAsset', sfConfig::get('app_lyMediaManager_assets_per_page', 20));
     $this->pager->setQuery($this->folder->retrieveAssetsQuery(array('sort_field' => $this->sort_field, 'sort_dir' => $this->sort_dir)));
     $this->pager->setPage($this->getUser()->getAttribute('page', 1));
     $this->pager->init();
     if ($request->getParameter('popup')) {
         $this->getUser()->setAttribute('popup', true);
     } else {
         $this->getUser()->getAttributeHolder()->remove('popup');
     }
     if ($this->popup = $this->getUser()->getAttribute('popup')) {
         $this->setLayout($this->getContext()->getConfiguration()->getTemplateDir('lyMediaAsset', 'popupLayout.php') . DIRECTORY_SEPARATOR . 'popupLayout');
         $this->getResponse()->addJavascript('/lyMediaManagerPlugin/js/lymedia_popup.js');
         if ($request->hasParameter('editor')) {
             $this->getUser()->setAttribute('editor', $request->getParameter('editor') == 'fck' ? 'fck' : 'tiny');
         }
         if ($this->getUser()->getAttribute('editor') == 'fck') {
             $this->getResponse()->addJavascript('/lyMediaManagerPlugin/js/lymedia_fck_popup.js', 'last');
         } else {
             $this->getResponse()->addJavascript('tiny_mce/tiny_mce_popup');
             $this->getResponse()->addJavascript('/lyMediaManagerPlugin/js/lymedia_tiny_popup.js', 'last');
         }
         $this->getResponse()->addStyleSheet('/lyMediaManagerPlugin/css/lymedia_popup.css');
     }
     $this->getUser()->setAttribute('view', 'icons');
     $this->folder_form = new lyMediaCreateFolderForm();
     $this->asset_form = new lyMediaSimplerAssetForm(null, array('folder_id' => $this->folder->getId()));
     $this->nbfolders = $this->folders ? count($this->folders) : 0;
     $this->total_size = $this->folder->sumFileSizes();
 }
开发者ID:hartym,项目名称:lyMediaManagerPlugin,代码行数:59,代码来源:BaselyMediaAssetActions.class.php

示例13: executeListing

 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
     if ($request->hasParameter('projects_id')) {
         $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
         if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
     } else {
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         if (Users::hasAccess('view_own', 'tasks', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
     }
     if ($this->reports_id > 0) {
         $q = UserReports::addFiltersToQuery($q, $this->reports_id, $this->getUser()->getAttribute('id'));
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'TasksComments', 't', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'tasks', $this->getUser());
     } else {
         $q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
         $q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
     }
     $this->pager = false;
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Tasks', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->tasks_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=userReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = 'redirect_to=tasksList';
         if ($request->hasParameter('projects_id')) {
             $this->url_params = 'projects_id=' . $request->getParameter('projects_id');
         }
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
     $this->users_schema = Users::getSchema();
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:52,代码来源:components.class.php

示例14: executeSubmitExam

 public function executeSubmitExam(sfWebRequest $request)
 {
     if ($request->isMethod(sfRequest::POST) && $request->hasParameter('security') && $request->hasParameter('year') && $request->hasParameter('descr')) {
         $files = $request->getFiles();
         $file = $files['file'];
         $descr = $request->getParameter('descr');
         if (isset($file) && strtoupper(substr($file['name'], -3, 3)) == 'PDF' && !helperFunctions::isMaliciousString($descr)) {
             if ($request->getParameter("security") != $_SESSION['securityImage']) {
                 echo "<input type='text' id='status' value='Security'/>";
                 exit;
             }
             $year = $request->getParameter("year") . $request->getParameter("term");
             // make directories if not exist
             if (!is_dir("exams/custom")) {
                 if (!mkdir("exams/custom")) {
                     echo "<input type='text' id='status' value='Moving'/>";
                     exit;
                 }
             }
             $tgt_path = "exams/custom/" . $year;
             if (!is_dir($tgt_path)) {
                 if (!mkdir($tgt_path)) {
                     echo "<input type='text' id='status' value='Moving'/>";
                     exit;
                 }
             }
             $fileName = time() . ".pdf";
             if (move_uploaded_file($file['tmp_name'], $tgt_path . "/" . $fileName)) {
                 // register in db
                 $conn = Propel::getConnection();
                 $exam = new Exam();
                 $exam->setCourseId($request->getParameter("course"));
                 $exam->setFilePath($tgt_path . "/" . $fileName);
                 $exam->setYear($year);
                 $exam->setType($request->getParameter("type"));
                 $exam->setDescr($descr);
                 $exam->save($conn);
                 // send notification email
                 $ip = $_SERVER['REMOTE_ADDR'];
                 $msg = "Submitted by " . $ip . " [id=" . $exam->getId() . "]";
                 helperFunctions::sendEmailNotice("Exam Submission", $msg);
                 echo "<input type='text' id='status' value='Success'/>";
             } else {
                 echo "<input type='text' id='status' value='Moving'/>";
             }
         } else {
             echo "<input type='text' id='status' value='PDF'/>";
         }
     }
     exit;
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:51,代码来源:actions.class.php

示例15: executeListing

 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
     if ($request->hasParameter('projects_id')) {
         $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
         if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     } else {
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         if (Users::hasAccess('view_own', 'tickets', $this->getUser())) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     }
     if ($this->reports_id > 0) {
         $q = TicketsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'TicketsComments', 't', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'tickets', $this->getUser());
     } else {
         $q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
         $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
     }
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Tickets', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->tickets_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=ticketsReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = 'redirect_to=ticketsList';
         if ($request->hasParameter('projects_id')) {
             $this->url_params = 'projects_id=' . $request->getParameter('projects_id');
         }
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:50,代码来源:components.class.php


注:本文中的sfWebRequest::hasParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。