Example #1
0
 /**
  * Gets the configuration settings for a userfilter field. The type of the
  * field is set via the request.
  */
 public function configure_action()
 {
     $this->conditionFields = UserFilterField::getAvailableFilterFields();
     if ($className = Request::option('fieldtype')) {
         list($fieldType, $param) = explode('_', $className);
         $this->className = $className;
         $this->field = new $fieldType($param);
     }
 }
Example #2
0
 /**
  * Standard constructor.
  *
  * @param  String conditionId
  * @return UserFilter
  */
 public function __construct($conditionId = '')
 {
     UserFilterField::getAvailableFilterFields();
     $this->id = $conditionId;
     if ($conditionId) {
         $this->load();
     } else {
         $this->id = $this->generateId();
     }
     return $this;
 }
 /**
  * @see UserFilterField::__construct
  */
 public function __construct($fieldId = '')
 {
     parent::__construct($fieldId);
     $this->validValues = array();
     $this->relations = array('DegreeCondition' => array('local_field' => 'abschluss_id', 'foreign_field' => 'abschluss_id'), 'SubjectCondition' => array('local_field' => 'studiengang_id', 'foreign_field' => 'studiengang_id'));
     $this->validCompareOperators = array('>=' => _('mindestens'), '<=' => _('höchstens'), '=' => _('ist'), '!=' => _('ist nicht'));
     // Initialize to some value in case there are no semester numbers.
     $maxsem = 15;
     // Calculate the maximal available semester.
     $stmt = DBManager::get()->query("SELECT MAX(" . $this->valuesDbIdField . ") AS maxsem " . "FROM `" . $this->valuesDbTable . "`");
     if ($current = $stmt->fetch(PDO::FETCH_ASSOC)) {
         if ($current['maxsem']) {
             $maxsem = $current['maxsem'];
         }
     }
     for ($i = 1; $i <= $maxsem; $i++) {
         $this->validValues[$i] = $i;
     }
 }
Example #4
0
 /**
  * Gets the template for the rule configuration form.
  *
  * @param String $ruleType Class name of the rule to configure.
  * @param String $ruleId   Optional ID of an existing rule.
  */
 public function configure_action($ruleType = '', $ruleId = '')
 {
     $this->ruleTypes = AdmissionRule::getAvailableAdmissionRules();
     UserFilterField::getAvailableFilterFields();
     $this->ruleType = $ruleType;
     // Check if rule data has been given via request.
     if (Request::get('rule')) {
         $rule = unserialize(Request::get('rule'));
         if ($ruleType == get_class($rule)) {
             $this->rule = $rule;
         }
     } else {
         if (in_array($ruleType, array_keys($this->ruleTypes))) {
             $this->rule = new $ruleType($ruleId);
         }
     }
     if ($this->rule) {
         $this->ruleTemplate = $this->rule->getTemplate();
     }
 }
Example #5
0
 /**
  * @see AuthenticatedController::before_filter
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->conditionFields = UserFilterField::getAvailableFilterFields();
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     } else {
         $layout = $GLOBALS['template_factory']->open('layouts/base');
         $this->set_layout($layout);
         PageLayout::setTitle(_('Auswahlbedingungen'));
         Navigation::activateItem('/tools/coursesets');
     }
     PageLayout::addSqueezePackage('userfilter');
     $this->set_content_type('text/html;charset=windows-1252');
 }
Example #6
0
 /**
  * @see UserFilterField::__construct
  */
 public function __construct($fieldId = '')
 {
     parent::__construct($fieldId);
     $this->relations = array('DegreeCondition' => array('local_field' => 'abschluss_id', 'foreign_field' => 'abschluss_id'));
 }
 /**
  * Uses the given data to fill the object values. This can be used
  * as a generic function for storing data if the concrete rule type
  * isn't known in advance.
  *
  * @param Array $data
  * @return AdmissionRule This object.
  */
 public function setAllData($data)
 {
     UserFilterField::getAvailableFilterFields();
     parent::setAllData($data);
     $this->conditions = array();
     foreach ($data['conditions'] as $condition) {
         $this->addCondition(unserialize($condition));
     }
     return $this;
 }
Example #8
0
 /**
  * @see UserFilterField::__construct
  */
 public function __construct($fieldId = '')
 {
     parent::__construct($fieldId);
     $this->relations = array('SubjectCondition' => array('local_field' => 'studiengang_id', 'foreign_field' => 'studiengang_id'));
 }