Example #1
0
 /**
  * Checks whether we have a valid logged in user,
  * send "Forbidden" otherwise
  *
  * @param String $action The action to perform
  * @param Array  $args   Potential arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Check for a valid logged in user (only when an ajax request occurs)
     if (Request::isXHR() && (!is_object($GLOBALS['user']) || $GLOBALS['user']->id === 'nobody')) {
         $this->response->set_status(403);
         $action = 'nop';
     }
 }
Example #2
0
 /**
  * createEvaluationFooter: generate the foot of an evaluation (buttons etc.)
  * @param   the evaluation
  * @returns a table row
  */
 function createEvaluationFooter($eval, $voted, $isPreview)
 {
     global $auth;
     if ($isPreview) {
         $voted = YES;
     }
     $br = new HTMpty("br");
     $tr = new HTM("tr");
     $td = new HTM("td");
     $td->attr("class", "content_body");
     $td->attr("align", "center");
     $td->attr("data-dialog-button", "");
     $td->cont($br);
     /* vote button */
     if (!$voted) {
         $button = Button::createAccept(_('Abschicken'), 'voteButton', array('title' => _('Senden Sie Ihre Antworten hiermit ab.'), 'data-dialog' => ''));
         $td->cont($button);
     }
     /* close button */
     if (!Request::isXHR()) {
         $button = new HTM("p");
         $button->cont(_("Sie können dieses Fenster jetzt schließen."));
         $td->cont($button);
     }
     /* reload button */
     if ($isPreview) {
         $button = LinkButton::create(_('Aktualisieren'), URLHelper::getURL('show_evaluation.php?evalID=' . $eval->getObjectID() . '&isPreview=1'), array('title' => _('Vorschau aktualisieren.')));
         $td->cont($button);
     }
     $td->cont($br);
     $td->cont($br);
     $tr->cont($td);
     return $tr;
 }
Example #3
0
    $table->cont($lib->createEvaluationHeader($eval, $votedNow, $votedEarlier));
} elseif ($votedEarlier) {
    /* header ------ */
    $table->cont($lib->createEvaluationHeader($eval, $votedNow, $votedEarlier));
} else {
    /* header ------ */
    $table->cont($lib->createEvaluationHeader($eval, $votedNow, $votedEarlier));
    /* the whole evaluation ------ */
    $table->cont($lib->createEvaluation($tree));
}
/* footer ------ */
$table->cont($lib->createEvaluationFooter($eval, $votedNow || $votedEarlier, $isPreview));
$form->cont($table);
/* Ausgabe erzeugen---------------------------------------------------------- */
//Content (TODO: besser mit TemplateFactory)
if (Request::isXHR()) {
    echo $form->createContent();
} else {
    $layout = $GLOBALS['template_factory']->open('layouts/base.php');
    $layout->content_for_layout = $form->createContent();
    echo $layout->render();
}
page_close();
/**
 * checkMandatoryItems:
 * put IDs of mandatory questions into global array $mandatories
 *  (or, if the user has voted, the IDs of the mandatory questions, which he did not answer to)
 *
 * @param object  the Evaluation object (when called externally).
 */
function checkMandatoryItems($item)