Ejemplo n.º 1
0
     //highlight
     $highlight_style = $_POST['highlight']['style'];
     //array
     $highlight_color = array_search(strtoupper($_POST['highlight']['color']), $viewhelper->colorarray);
     $stylebin = '';
     for ($i = 1; $i <= 3; $i++) {
         $stylebin .= empty($highlight_style[$i]) ? '0' : '1';
     }
     $highlight_style = bindec($stylebin);
     if ($highlight_style < 0 || $highlight_style > 7 || $highlight_color < 0 || $highlight_color > 8) {
     } else {
         $highlight_style = $highlight_style . $highlight_color;
         $vals['highlight'] = $highlight_style;
     }
     //end highlight
     $result = $industry->save($vals, "update", $id);
 } elseif (!empty($_POST['data']['names'])) {
     $names = explode("\r\n", $_POST['data']['names']);
     $tmp_name = array();
     if (!empty($names)) {
         foreach ($names as $val) {
             $name = $val;
             if (!empty($name)) {
                 $tmp_name[] = "('" . $name . "','" . $_POST['data']['industry']['url'] . "','" . $parent_id . "','" . $top_parentid . "','" . $level . "','" . $_POST['data']['industry']['display_order'] . "','" . $_POST['data']['industry']['industrytype_id'] . "','')";
             }
         }
         $values = implode(",", $tmp_name);
         $sql = "INSERT INTO {$tb_prefix}industries (name,url,parent_id,top_parentid,level,display_order,industrytype_id,path) VALUES " . $values;
         $result = $pdb->Execute($sql);
     }
 }