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


PHP Codendi_Request::isAjax方法代码示例

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


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

示例1: sendResponse

 private function sendResponse(Codendi_Request $request, $feedback_level, $message, $unsubscribe)
 {
     if ($request->isAjax()) {
         $this->sendAjaxResponse($unsubscribe, $message);
         return;
     }
     $GLOBALS['Response']->addFeedback($feedback_level, $message);
     $GLOBALS['Response']->redirect($this->artifact->getUri());
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:ArtifactNotificationSubscriber.class.php

示例2: __construct

 public function __construct(Codendi_Request $request)
 {
     $this->project = $request->getProject();
     $this->words = $request->get('words');
     $this->offset = intval($request->getValidated('offset', 'uint', 0));
     $this->exact = $request->getValidated('exact', 'uint', false);
     $this->trackerv3id = $request->getValidated('atid', 'uint', 0);
     $this->forum_id = $request->getValidated('forum_id', 'uint', 0);
     $this->is_ajax = $request->isAjax();
     $this->type_of_search = $request->get('type_of_search');
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:SearchQuery.class.php

示例3: checkServiceEnabled

 /**
  * Check that the service is used and the plugin is allowed for project $project
  * if it is not the case then exit with an error
  *
  * @param Project         $project
  * @param Codendi_Request $request
  *
  * @return bool true if success. Otherwise the process terminates.
  */
 public function checkServiceEnabled(Project $project, Codendi_Request $request)
 {
     if ($project->usesService('plugin_tracker')) {
         return true;
     }
     header("HTTP/1.0 404 Not Found");
     if (!$request->isAjax()) {
         $GLOBALS['Response']->addFeedback('error', "The project doesn't use the 'tracker v5' service");
         $GLOBALS['HTML']->redirect('/projects/' . $project->getUnixName() . '/');
     }
     exit;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:21,代码来源:TrackerManager.class.php

示例4: route

 public function route(Codendi_Request $request)
 {
     if ($request->existAndNonEmpty('type_of_search')) {
         if ($request->isAjax()) {
             $this->controller->ajaxResults($request);
         } else {
             $this->controller->results($request);
         }
     } else {
         $this->controller->index($request);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:SearchRouter.class.php

示例5: processUpdate

 /**
  * Update the form element
  *
  * @param Tracker_IDisplayTrackerLayout  $layout          Displays the page header and footer
  * @param Codendi_Request                $request         The data coming from the user
  * @param PFUser                           $current_user    The user who mades the request
  * @param bool                           $redirect        Do we need to redirect? default is false
  *
  * @return void
  */
 protected function processUpdate(Tracker_IDisplayTrackerLayout $layout, $request, $current_user, $redirect = false)
 {
     if (is_array($request->get('formElement_data'))) {
         $formElement_data = $request->get('formElement_data');
         //First store the specific properties if needed
         if (!isset($formElement_data['specific_properties']) || !is_array($formElement_data['specific_properties']) || $this->storeProperties($formElement_data['specific_properties'])) {
             //Then store the formElement itself
             if (Tracker_FormElementFactory::instance()->updateFormElement($this, $formElement_data)) {
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'field_updated'));
                 if ($request->isAjax()) {
                     echo $this->fetchAdminFormElement();
                     exit;
                 } else {
                     $redirect = true;
                 }
             }
         }
     } else {
         if ($request->get('change-type')) {
             if (Tracker_FormElementFactory::instance()->changeFormElementType($this, $request->get('change-type'))) {
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'field_type_changed'));
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'field_type_not_changed'));
             }
             $redirect = true;
         }
     }
     if ($redirect) {
         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . (int) $this->tracker_id . '&func=admin-formElements');
     }
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:41,代码来源:Tracker_FormElement.class.php

示例6: process

 /**
  * Process the artifact functions
  *
  * @param Tracker_IDisplayTrackerLayout  $layout          Displays the page header and footer
  * @param Codendi_Request                $request         The data from the user
  * @param User                           $current_user    The current user
  *
  * @return void
  */
 public function process(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     switch ($request->get('func')) {
         case 'update-comment':
             if ((int) $request->get('changeset_id') && $request->get('content')) {
                 if ($changeset = $this->getChangeset($request->get('changeset_id'))) {
                     $changeset->updateComment($request->get('content'), $current_user);
                     if ($request->isAjax()) {
                         //We assume that we can only change a comment from a followUp
                         echo $changeset->getComment()->fetchFollowUp();
                     }
                 }
             }
             break;
         case 'preview-attachment':
         case 'show-attachment':
             if ((int) $request->get('field') && (int) $request->get('attachment')) {
                 $ff = Tracker_FormElementFactory::instance();
                 //TODO: check that the user can read the field
                 if ($field = $ff->getFormElementByid($request->get('field'))) {
                     $method = explode('-', $request->get('func'));
                     $method = $method[0];
                     $method .= 'Attachment';
                     if (method_exists($field, $method)) {
                         $field->{$method}($request->get('attachment'));
                     }
                 }
             }
             break;
         case 'artifact-delete-changeset':
             // @see comment in Tracker_Artifact_Changeset::fetchFollowUp()
             //if ($changeset = $this->getChangeset($request->get('changeset'))) {
             //    $changeset->delete($current_user);
             //}
             $GLOBALS['Response']->redirect('?aid=' . $this->id);
             break;
         case 'artifact-update':
             //TODO : check permissions on this action?
             $fields_data = $request->get('artifact');
             $this->setUseArtifactPermissions($request->get('use_artifact_permissions') ? 1 : 0);
             $this->getTracker()->augmentDataFromRequest($fields_data);
             if ($this->createNewChangeset($fields_data, $request->get('artifact_followup_comment'), $current_user, $request->get('email'))) {
                 $art_link = $this->fetchDirectLinkToArtifact();
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_index', 'update_success', array($art_link)), CODENDI_PURIFIER_LIGHT);
                 $this->summonArtifactRedirectors($request);
                 $GLOBALS['Response']->redirect($this->getRedirectUrlAfterArtifactUpdate($request, $this->tracker_id, $this->getId()));
             } else {
                 $this->display($layout, $request, $current_user);
             }
             break;
         case 'unassociate-artifact-to':
             $artlink_fields = $this->getFormElementFactory()->getUsedArtifactLinkFields($this->getTracker());
             $linked_artifact_id = $request->get('linked-artifact-id');
             if (count($artlink_fields)) {
                 $this->unlinkArtifact($artlink_fields, $linked_artifact_id, $current_user);
                 $this->summonArtifactAssociators($request, $current_user, $linked_artifact_id);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker', 'must_have_artifact_link_field'));
                 $GLOBALS['Response']->sendStatusCode(400);
             }
             break;
         case 'associate-artifact-to':
             $linked_artifact_id = $request->get('linked-artifact-id');
             if (!$this->linkArtifact($linked_artifact_id, $current_user)) {
                 $GLOBALS['Response']->sendStatusCode(400);
             } else {
                 $this->summonArtifactAssociators($request, $current_user, $linked_artifact_id);
             }
             break;
         case 'higher-priority-than':
             $dao = new Tracker_Artifact_PriorityDao();
             $dao->moveArtifactBefore($this->getId(), (int) $request->get('target-id'));
             break;
         case 'lesser-priority-than':
             $dao = new Tracker_Artifact_PriorityDao();
             $dao->moveArtifactAfter($this->getId(), (int) $request->get('target-id'));
             break;
         default:
             if ($request->isAjax()) {
                 echo $this->fetchTooltip($current_user);
             } else {
                 $this->display($layout, $request, $current_user);
             }
             break;
     }
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:95,代码来源:Tracker_Artifact.class.php

示例7: displayAReport

 /**
  * Display a report. Choose the report among
  *  - the requested 'select_report'
  *  - the last viewed report (stored in preferences)
  *  - the default report of this tracker
  *
  * If the user request a 'link-artifact-id' then display also manual and recent 
  * panels to ease the selection of artifacts to link
  *
  * @param Tracker_IDisplayTrackerLayout  $layout          Displays the page header and footer
  * @param Codendi_Request                $request         The request
  * @param User                           $current_user    The user who made the request
  *
  * @return void
  */
 public function displayAReport(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     $report = null;
     //Does the user wants to change its report?
     if ($request->get('select_report') && $request->isPost()) {
         //Is the report id valid
         if ($report = $this->getReportFactory()->getReportById($request->get('select_report'), $current_user->getid())) {
             $current_user->setPreference('tracker_' . $this->id . '_last_report', $report->id);
         }
     }
     //If no valid report found. Search the last viewed report for the user
     if (!$report) {
         if ($report_id = $current_user->getPreference('tracker_' . $this->id . '_last_report')) {
             $report = $this->getReportFactory()->getReportById($report_id, $current_user->getid());
         }
     }
     //If no valid report found. Take the default one
     if (!$report) {
         $report = $this->getReportFactory()->getDefaultReportsByTrackerId($this->id);
     }
     $link_artifact_id = (int) $request->get('link-artifact-id');
     if ($link_artifact_id && !$request->get('report-only')) {
         $linked_artifact = Tracker_ArtifactFactory::instance()->getArtifactById($link_artifact_id);
         if (!$linked_artifact) {
             $err = "Linked artifact not found or doesn't exist";
             if (!$request->isAjax()) {
                 $GLOBALS['Response']->addFeedback('error', $err);
                 $GLOBALS['Response']->redirect('/');
             }
             die($err);
         }
         if (!$request->isAjax()) {
             //screwed up
             $GLOBALS['Response']->addFeedback('error', 'Something is wrong with your request');
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?aid=' . $linked_artifact->getId());
         }
         echo $linked_artifact->fetchTitle($GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'title_prefix'));
         echo '<input type="hidden" id="link-artifact-id" value="' . (int) $link_artifact_id . '" />';
         echo '<table id="tracker-link-artifact-different-ways" cellpadding="0" cellspacing="0" border="0"><tbody><tr>';
         //the fast ways
         echo '<td id="tracker-link-artifact-fast-ways">';
         //Manual
         echo '<div id="tracker-link-artifact-manual-way">';
         echo '<div class="boxtitle">';
         echo $GLOBALS['HTML']->getImage('ic/lightning-white.png', array('style' => 'vertical-align:middle')) . '&nbsp;';
         echo $GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'manual_panel_title');
         echo '</div>';
         echo '<div class="tracker-link-artifact-manual-way-content">';
         echo $GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'manual_panel_desc');
         echo '<p><label for="link-artifact-manual-field">';
         echo $GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'manual_panel_label');
         echo '</label><br />';
         echo '<input type="text" name="link-artifact[manual]" value="" id="link-artifact-manual-field" />';
         echo '</p>';
         echo '</div>';
         echo '</div>';
         //History
         echo '<div id="tracker-link-artifact-recentitems-way">';
         echo '<div class="boxtitle">';
         echo $GLOBALS['HTML']->getImage('ic/star-white.png', array('style' => 'vertical-align:middle')) . '&nbsp;';
         echo $GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'recent_panel_title');
         echo '</div>';
         echo '<div class="tracker-link-artifact-recentitems-way-content">';
         if ($recent_items = $current_user->getRecentElements()) {
             echo $GLOBALS['Language']->getText('plugin_tracker_artifactlink', 'recent_panel_desc');
             echo '<ul>';
             foreach ($recent_items as $item) {
                 if ($item['id'] != $link_artifact_id) {
                     echo '<li>';
                     echo '<input type="checkbox" 
                                  name="link-artifact[recent][]" 
                                  value="' . (int) $item['id'] . '" /> ';
                     echo $item['link'];
                     echo '</li>';
                 }
             }
             echo '</ul>';
         }
         echo '</div>';
         echo '</div>';
         //end of fast ways
         echo '</td>';
         //And the slow way (aka need to search)
         if ($report) {
             echo '<td><div id="tracker-link-artifact-slow-way">';
//.........这里部分代码省略.........
开发者ID:nterray,项目名称:tuleap,代码行数:101,代码来源:Tracker.class.php

示例8: executeRedirect

 private function executeRedirect(Codendi_Request $request, Tracker_Artifact $artifact, Tracker_Artifact_Redirect $redirect)
 {
     if ($request->isAjax()) {
         header(json_header(array('aid' => $artifact->getId())));
         exit;
     } else {
         if ($this->isFromOverlay($request)) {
             echo '<script>window.parent.codendi.tracker.artifact.artifactLink.newArtifact(' . (int) $artifact->getId() . ');</script>';
             exit;
         } else {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_index', 'create_success', array($artifact->fetchXRefLink())), CODENDI_PURIFIER_LIGHT);
             $GLOBALS['Response']->redirect($redirect->toUrl());
         }
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:15,代码来源:CreateArtifact.class.php


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