Example #1
0
 public function addFlagInput($post)
 {
     $data = $this->record->getData($this->getPage());
     $flag = new Flag();
     $flag->link_id = $this->record->getID();
     $flag->pages_name = $this->getPage();
     foreach ($post as $key => $value) {
         $page = substr($key, 0, strpos($key, "-"));
         // Split out class and name from input field
         $fieldName = substr($key, strpos($key, "-") + 1);
         if ($page == 'flag') {
             $flag->set($fieldName, $value);
         }
     }
     if ($flag->isComplete()) {
         $data->delete($flag->getFieldName());
         $flag->saveToDB();
         $flag->getFromDB();
         $flag->flag_id = $flag->getID();
     } else {
         $flag = null;
     }
     return $flag;
 }