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


PHP Codendi_Request::existAndNonEmpty方法代码示例

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


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

示例1: register_valid

function register_valid(Codendi_Request $request)
{
    global $Language;
    if (!$request->existAndNonEmpty('Update')) {
        return false;
    }
    if (!$request->existAndNonEmpty('user_id')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_userid'));
        return false;
    }
    if (!$request->existAndNonEmpty('form_pw')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_nopasswd'));
        return false;
    }
    if ($request->get('form_pw') != $request->get('form_pw2')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_passwd'));
        return false;
    }
    $errors = array();
    if (!account_pwvalid($request->get('form_pw'), $errors)) {
        foreach ($errors as $e) {
            $GLOBALS['Response']->addFeedback('error', $e);
        }
        return false;
    }
    // if we got this far, it must be good
    $user_manager = UserManager::instance();
    $user = $user_manager->getUserById($request->get('user_id'));
    $user->setPassword($request->get('form_pw'));
    if (!$user_manager->updateDb($user)) {
        $GLOBALS['Response']->addFeedback(Feedback::ERROR, $Language->getText('admin_user_changepw', 'error_update'));
        return false;
    }
    return true;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:user_changepw.php

示例2: process

 public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
 {
     $workflow = $this->workflow_factory->getWorkflowByTrackerId($this->tracker->id);
     $this->processEnabled($workflow, $request->get('is_used'));
     $k = 0;
     $field = $this->form_element_factory->getFormElementById($workflow->field_id);
     $field_values = $field->getBind()->getAllValues();
     $currMatrix = array();
     $field_value_from = null;
     //Add an initial state transition
     foreach ($field_values as $field_value_id_to => $field_value_to) {
         //$field_value_from=;
         $transition = '_' . $field_value_id_to;
         if ($request->existAndNonEmpty($transition)) {
             $currMatrix[] = array('', $field_value_id_to);
             $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
         }
     }
     //Add a transition
     foreach ($field_values as $field_value_id_from => $field_value_from) {
         foreach ($field_values as $field_value_id_to => $field_value_to) {
             $transition = $field_value_id_from . '_' . $field_value_id_to;
             if ($request->existAndNonEmpty($transition)) {
                 $currMatrix[] = array($field_value_id_from, $field_value_id_to);
                 $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
             }
         }
     }
     //Delete a transition
     $transitions_in_db = $workflow->getTransitions();
     $nb_transitions_in_db = count($transitions_in_db);
     for ($i = 0; $i < $nb_transitions_in_db; $i++) {
         $field_value_from = $transitions_in_db[$i]->getFieldValueFrom();
         $field_value_to = $transitions_in_db[$i]->getFieldValueTo();
         //Treatment of the initial state
         if ($field_value_from == null) {
             $value_to_search = array('', $field_value_to->getId());
             //$field_value_from->getId()='';
         } else {
             $value_to_search = array($field_value_from->getId(), $field_value_to->getId());
         }
         if (!in_array($value_to_search, $currMatrix)) {
             $this->workflow_factory->deleteTransition($workflow->workflow_id, $field_value_from, $field_value_to);
             $k++;
         }
     }
     if ($k > 0) {
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'updated'));
     }
     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => Workflow::FUNC_ADMIN_TRANSITIONS)));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:51,代码来源:CreateMatrix.class.php

示例3: process

 public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
 {
     if ($request->existAndNonEmpty('field_id')) {
         if ($this->workflow_factory->create((int) $this->tracker->id, $request->get('field_id'))) {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'created'));
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => Workflow::FUNC_ADMIN_TRANSITIONS)));
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:Create.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: process

 /**
  * Process the artifact functions
  *
  * @param Transition      $transition   The transition
  * @param Codendi_Request $request      The data from the user
  * @param PFUser            $current_user The current user
  *
  * @return void
  */
 public function process(Transition $transition, Codendi_Request $request, PFUser $current_user)
 {
     $transition_condition_factory = $this->getConditionFactory();
     // Create new condition
     if ($request->existAndNonEmpty('add_notempty_condition')) {
         $transition_condition_factory->addCondition($transition, $request->get('add_notempty_condition'));
     }
     // Loop over defined actions and update them if relevant
     foreach ($transition->getConditions() as $condition) {
         $condition->process($request);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:ConditionManager.class.php

示例6: process

 /**
  * Process the artifact functions
  *
  * @param Transition      $transition   The transition
  * @param Codendi_Request $request      The data from the user
  * @param PFUser            $current_user The current user
  *
  * @return void
  */
 public function process(Transition $transition, Codendi_Request $request, PFUser $current_user)
 {
     $tpaf = $this->getPostActionFactory();
     // Create new post-action
     if ($request->existAndNonEmpty('add_postaction')) {
         $tpaf->addPostAction($transition, $request->get('add_postaction'));
     }
     // Loop over defined actions and update them if relevant
     foreach ($transition->getAllPostActions() as $post_action) {
         $post_action->process($request);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:Transition_PostActionManager.class.php

示例7: doCreateTracker

 public function doCreateTracker(Project $project, Codendi_Request $request)
 {
     $is_error = false;
     $new_tracker = null;
     $name = trim($request->get('name'));
     $description = trim($request->get('description'));
     $itemname = trim($request->get('itemname'));
     $atid_template = $request->getValidated('atid_template', 'uint', 0);
     // First try XML
     if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'xml') {
         $vFile = new Valid_File('tracker_new_xml_file');
         $vFile->required();
         if ($request->validFile($vFile)) {
             try {
                 $user_finder = new XMLImportHelper(UserManager::instance());
                 $new_tracker = TrackerXmlImport::build($user_finder)->createFromXMLFileWithInfo($project->getID(), $_FILES["tracker_new_xml_file"]["tmp_name"], $name, $description, $itemname);
             } catch (XML_ParseException $exception) {
                 $this->displayCreateTrackerFromXMLErrors($project, $exception->getErrors(), $exception->getFileLines());
             } catch (TrackerFromXmlException $exception) {
                 $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage());
             }
         }
     } else {
         if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'tv3') {
             $atid = $request->get('tracker_new_tv3');
             $user = UserManager::instance()->getCurrentUser();
             $new_tracker = $this->getTrackerFactory()->createFromTV3($user, $atid, $project, $name, $description, $itemname);
         } else {
             if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'migrate_from_tv3') {
                 $tracker_id = $request->get('tracker_new_tv3');
                 if ($this->getTV3MigrationManager()->askForMigration($project, $tracker_id, $name, $description, $itemname)) {
                     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $project->group_id);
                 }
             } else {
                 // Otherwise tries duplicate
                 $duplicate = $this->getTrackerFactory()->create($project->getId(), -1, $atid_template, $name, $description, $itemname);
                 $new_tracker = $duplicate['tracker'];
             }
         }
     }
     if ($new_tracker) {
         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $project->group_id . '&tracker=' . $new_tracker->id);
     } else {
         $tracker_template = $this->getTrackerFactory()->getTrackerById($atid_template);
         $this->displayCreateTracker($project, $request, $name, $description, $itemname, $tracker_template);
     }
 }
开发者ID:blestab,项目名称:tuleap,代码行数:47,代码来源:TrackerManager.class.php

示例8: process

 public function process(TrackerManager $engine, Codendi_Request $request, User $current_user)
 {
     if ($request->get('create')) {
         if ($request->existAndNonEmpty('field_id')) {
             if (WorkflowFactory::instance()->create((int) $this->tracker->id, $request->get('field_id'))) {
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'created'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-workflow')));
             }
         }
     } else {
         if ($request->get('edit_transition')) {
             $workflow = WorkflowFactory::instance()->getWorkflowByTrackerId($this->tracker->id);
             $transition = TransitionFactory::instance()->getTransition($request->get('edit_transition'));
             $this->displayTransitionDetails($engine, $request, $current_user, $transition);
         } else {
             if ($request->get('delete')) {
                 if (WorkflowFactory::instance()->deleteWorkflow($request->get('delete'))) {
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'deleted'));
                     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-workflow')));
                 }
             } else {
                 if ($request->get('create_matrix')) {
                     $k = 0;
                     $workflow = WorkflowFactory::instance()->getWorkflowByTrackerId($this->tracker->id);
                     $field = Tracker_FormElementFactory::instance()->getFormElementById($workflow->field_id);
                     $field_values = $field->getBind()->getAllValues();
                     $currMatrix = array();
                     $field_value_from = null;
                     //Add an initial state transition
                     foreach ($field_values as $field_value_id_to => $field_value_to) {
                         //$field_value_from=;
                         $transition = '_' . $field_value_id_to;
                         if ($request->existAndNonEmpty($transition)) {
                             $currMatrix[] = array('', $field_value_id_to);
                             $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
                         }
                     }
                     //Add a transition
                     foreach ($field_values as $field_value_id_from => $field_value_from) {
                         foreach ($field_values as $field_value_id_to => $field_value_to) {
                             $transition = $field_value_id_from . '_' . $field_value_id_to;
                             if ($request->existAndNonEmpty($transition)) {
                                 $currMatrix[] = array($field_value_id_from, $field_value_id_to);
                                 $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
                             }
                         }
                     }
                     //Delete a transition
                     $transitions_in_db = $workflow->getTransitions();
                     $nb_transitions_in_db = count($transitions_in_db);
                     for ($i = 0; $i < $nb_transitions_in_db; $i++) {
                         $field_value_from = $transitions_in_db[$i]->getFieldValueFrom();
                         $field_value_to = $transitions_in_db[$i]->getFieldValueTo();
                         //Treatment of the initial state
                         if ($field_value_from == null) {
                             $value_to_search = array('', $field_value_to->getId());
                             //$field_value_from->getId()='';
                         } else {
                             $value_to_search = array($field_value_from->getId(), $field_value_to->getId());
                         }
                         if (!in_array($value_to_search, $currMatrix)) {
                             WorkflowFactory::instance()->deleteTransition($workflow->workflow_id, $field_value_from, $field_value_to);
                             $k++;
                         }
                     }
                     if ($k > 0) {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'updated'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-workflow')));
                     } else {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'not_updated'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-workflow')));
                     }
                 } else {
                     if ($request->get('enable_workflow')) {
                         $workflow = WorkflowFactory::instance()->getWorkflowByTrackerId($this->tracker->id);
                         $is_used = $request->get('is_used');
                         //TODO : use $request
                         if ($is_used == 'on') {
                             $is_used = 1;
                             $feedback = $GLOBALS['Language']->getText('workflow_admin', 'workflow_enabled');
                         } else {
                             $is_used = 0;
                             $feedback = $GLOBALS['Language']->getText('workflow_admin', 'workflow_disabled');
                         }
                         if (WorkflowFactory::instance()->updateActivation((int) $workflow->workflow_id, $is_used)) {
                             $GLOBALS['Response']->addFeedback('info', $feedback);
                             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-workflow')));
                         }
                     } else {
                         if ($request->get('workflow_details')) {
                             $transition = $request->get('transition');
                             //TODO check that the transition belongs to the current tracker
                             // Permissions
                             $ugroups = $request->get('ugroups');
                             permission_clear_all($this->tracker->group_id, 'PLUGIN_TRACKER_WORKFLOW_TRANSITION', $transition, false);
                             if (TransitionFactory::instance()->addPermissions($ugroups, $transition)) {
                                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'permissions_updated'));
                             } else {
                                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('workflow_admin', 'permissions_not_updated'));
                             }
//.........这里部分代码省略.........
开发者ID:nterray,项目名称:tuleap,代码行数:101,代码来源:WorkflowManager.class.php

示例9: manageLockNewVersion

 private function manageLockNewVersion(PFUser $user, Docman_Item $item, Codendi_Request $request)
 {
     $permission_manager = $this->_getDocmanPermissionsManagerInstance($item->getGroupId());
     if ($request->existAndNonEmpty('lock_document')) {
         if (!$permission_manager->getLockFactory()->itemIsLocked($item)) {
             $permission_manager->getLockFactory()->lock($item);
             $this->_raiseLockEvent($item, $user);
         }
     } else {
         if ($permission_manager->getLockFactory()->itemIsLocked($item)) {
             $permission_manager->getLockFactory()->unlock($item);
             $this->_raiseUnlockEvent($item, $user);
         }
     }
 }
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:15,代码来源:Docman_Actions.class.php

示例10: displayCreateTracker

 /**
  * Display tracker creation interface
  *
  * @param Project $project
  * @param String $name
  * @param String $description
  * @param String $itemname
  * @param Tracker      $tracker_template
  */
 public function displayCreateTracker(Project $project, Codendi_Request $request, $name = '', $description = '', $itemname = '', Tracker $tracker_template = null)
 {
     global $Language;
     $breadcrumbs = array(array('title' => $GLOBALS['Language']->getText('plugin_tracker_index', 'create_new_tracker'), 'url' => TRACKER_BASE_URL . '/?group_id=' . $project->group_id . '&amp;func=create'));
     $toolbar = array();
     $this->displayHeader($project, 'Trackers', $breadcrumbs, $toolbar);
     $hp = Codendi_HTMLPurifier::instance();
     echo '<h2>' . $Language->getText('plugin_tracker_include_type', 'create_tracker') . '</h2>';
     echo '<form name="form_create" method="post" enctype="multipart/form-data" id="tracker_create_new">
       <input type="hidden" name="group_id" value="' . $project->getId() . '">
       <input type="hidden" name="func" value="docreate">
       
       <table>
       <tr valign="top"><td style="padding-right:2em; border-right: 1px solid #eee;">';
     echo '<p>' . $Language->getText('plugin_tracker_include_type', 'choose_creation') . '</p>';
     if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'xml') {
         $this->displayCreateTrackerFromXML($project);
     } else {
         $this->displayCreateTrackerFromTemplate($project, $tracker_template);
     }
     echo '</td><td style="padding-left:2em;">';
     echo '<p>' . $Language->getText('plugin_tracker_include_type', 'create_tracker_fill_name') . '</p>
       <p>
           <label for="newtracker_name"><b>' . $Language->getText('plugin_tracker_include_artifact', 'name') . '</b>: <font color="red">*</font></label><br />
           <input type="text" name="name" id="newtracker_name" value="' . $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . '">
       </p>
       <p>
           <label for="newtracker_description"><b>' . $Language->getText('plugin_tracker_include_artifact', 'desc') . '</b>: <font color="red">*</font><br />
           <textarea id="newtracker_description" name="description" rows="3" cols="50">' . $hp->purify($description, CODENDI_PURIFIER_CONVERT_HTML) . '</textarea>
       </p>
       <p>
           <label for="newtracker_itemname"><b>' . $Language->getText('plugin_tracker_include_type', 'short_name') . '</b>: <font color="red">*</font></label><br />
           <input type="text" id="newtracker_itemname" name="itemname" value="' . $hp->purify($itemname, CODENDI_PURIFIER_CONVERT_HTML) . '"><br />
           <span style="color:#999;">' . $Language->getText('plugin_tracker_include_type', 'avoid_spaces') . '</span>
       </p>';
     echo '<input type="submit" name="Create" value="' . $Language->getText('global', 'btn_create') . '">';
     echo '</td></tr></table></form>';
     $this->displayFooter($project);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:48,代码来源:TrackerManager.class.php

示例11: isFromOverlay

 private function isFromOverlay(Codendi_Request $request)
 {
     if ($request->existAndNonEmpty('link-artifact-id') && !$request->exist('immediate')) {
         return true;
     }
     return false;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:CreateArtifact.class.php


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