Exemplo n.º 1
0
 public function add($complaint, $lang, $parent = null)
 {
     $model = new complaintModel();
     $model->parent_id = $parent;
     $model->save();
     $dict = new dictModel();
     $dict->table_name = $this->_table;
     $dict->table_id = $model->id;
     $dict->lang = $lang;
     $dict->body = $complaint;
     return $dict->save();
 }
 foreach ($b[1] as $h) {
     $h = unhtml($h);
     $h = explode('.--', $h);
     if (count($h) == 1) {
         $desc = new descModel();
         $d = $desc->find('en', $book->id, $remedium->id);
         if (!$d) {
             $desc->add($h[0], 'en', $book->id, $remedium->id);
         } else {
             $dict = new dictModel($d);
             $dict->body = $h[0];
             $dict->save();
         }
     }
     if (count($h) == 2) {
         $complaint = new complaintModel();
         $complaint_name = strtolower($h[0]);
         if (strlen($complaint_name) > 25) {
             mydie($complaint_name);
         }
         switch ($complaint_name) {
             case 'relationship':
                 break;
             case 'dose':
                 break;
             case 'modalities':
                 foreach (explode('.', $h[1]) as $modal) {
                     $modal = trim($modal);
                     $mod = '';
                     if (strtolower(substr($modal, 0, 5)) == 'worse') {
                         $modal = trim(substr($modal, 5));