示例#1
0
 public function post_id_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $scale = new ServiceScalesModel($dbc);
     if (!is_array($this->id)) {
         echo _('Error: invalid input');
         return false;
     }
     $descriptions = FormLib::get('description', array());
     $hosts = FormLib::get('host', array());
     $types = FormLib::get('type', array());
     $dept = FormLib::get('scaleDept', array());
     $super = FormLib::get('super', array());
     $ep_st = FormLib::get('store-no', array());
     $ep_dept = FormLib::get('dept-no', array());
     $ep_addr = FormLib::get('address-no', array());
     for ($i = 0; $i < count($this->id); $i++) {
         $scale->reset();
         $scale->serviceScaleID($this->id[$i]);
         if (isset($descriptions[$i])) {
             $scale->description($descriptions[$i]);
         }
         if (isset($hosts[$i])) {
             $scale->host($hosts[$i]);
         }
         if (isset($types[$i])) {
             $scale->scaleType($types[$i]);
         }
         if (isset($dept[$i])) {
             $scale->scaleDeptName($dept[$i]);
         }
         if (isset($super[$i])) {
             if ($super[$i] === '') {
                 $super[$i] = null;
             }
             $scale->superID($super[$i]);
         }
         if (isset($ep_st[$i])) {
             $scale->epStoreNo($ep_st[$i]);
         }
         if (isset($ep_dept[$i])) {
             $scale->epDeptNo($ep_dept[$i]);
         }
         if (isset($ep_addr[$i])) {
             $scale->epScaleAddress($ep_addr[$i]);
         }
         $scale->save();
     }
     header('Location: ScaleEditor.php');
     return false;
 }