本文整理汇总了PHP中Codendi_Request::isPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Codendi_Request::isPost方法的具体用法?PHP Codendi_Request::isPost怎么用?PHP Codendi_Request::isPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codendi_Request
的用法示例。
在下文中一共展示了Codendi_Request::isPost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
{
try {
if (!$request->isPost()) {
$GLOBALS['Response']->addFeedback(Feedback::ERROR, 'Method must be post');
$GLOBALS['Response']->sendStatusCode(405);
return false;
}
$rule = $this->rule_manager->getRuleById($request->getValidated('id', 'uint', 0));
$this->rule_manager->delete($this->tracker, $rule);
} catch (Tracker_Exception $exception) {
$GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage());
$GLOBALS['Response']->sendStatusCode(400);
}
}
示例2: 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')) . ' ';
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')) . ' ';
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">';
//.........这里部分代码省略.........