コード例 #1
0
ファイル: Perpage.php プロジェクト: vigm/advancedMD
 /**
  * @see Filter::render() for the logic/behavior
  * Overriding the parent value to coerce the value into an int
  * and if we did not get one we will fall back and use the default value.
  *
  * @return int The number of items per page
  */
 public function value()
 {
     $value = parent::value();
     if (!(int) $value) {
         $value = $this->default_value;
     }
     return (int) $value;
 }
コード例 #2
0
ファイル: Site.php プロジェクト: vigm/advancedMD
 /**
  * @see Filter::render for render behavior and arguments
  *
  * Overrides the abstract render behavior by returning an empty string
  * if multtiple sites are not available.
  */
 public function render(ViewFactory $view, URL $url)
 {
     if (!$this->msm_enabled) {
         return '';
     }
     parent::render($view, $url);
 }
コード例 #3
0
ファイル: Username.php プロジェクト: vigm/advancedMD
 /**
  * @see Filter::value For the parent behavior
  *
  * Overriding the value method to account for someone searching for a
  * username, in which case we will use a $builder object (if provided)
  * to resolve that username to an ID.
  *
  * @return int[]|NULL The value of the filter (NULL if it has no value)
  */
 public function value()
 {
     if (isset($this->builder)) {
         $value = isset($_POST[$this->name]) ? $_POST[$this->name] : NULL;
         if ($value) {
             if (!is_numeric($value)) {
                 $this->display_value = $value;
                 $members = $this->builder->filter('username', 'LIKE', '%' . $value . '%')->all();
                 if ($members->count() > 0) {
                     $this->selected_value = $members->pluck('member_id');
                 } else {
                     $this->selected_value = array(-1);
                 }
             }
         }
     }
     $value = parent::value();
     if (!is_array($value)) {
         // Return NULL if it has no value
         if (is_null($value)) {
             return NULL;
         }
         $value = array($value);
     }
     return $value;
 }