Beispiel #1
0
 private function toggle($label_id = 0, $active = 0)
 {
     // Figure correct way to handle if no mark id
     if (empty($label_id) || !is_numeric($label_id)) {
         $this->data['errors'] = formatErrors(30);
     } else {
         $where = parent::isAdmin() === true ? "(labels.user_id IS NULL OR labels.user_id = '" . $this->user_id . "')" : "labels.user_id = '" . $this->user_id . "'";
         $label = $this->labels->update($where . " AND labels.label_id= '" . $label_id . "'", array('active' => $active));
         if ($label === false) {
             $this->data['errors'] = formatErrors(39);
         } else {
             $this->data['label'] = $label;
         }
     }
     // Figure view
     $this->figureView();
 }