function print_field_update($prefix, $parent_id = null, $area = null)
 {
     $value = null;
     if ($area) {
         $sql = "select t." . $this->get_db_field() . " from `" . DB_PREF . "" . $area->get_db_table() . "` t where " . $area->get_db_key() . " = '" . $parent_id . "' ";
         $rs = mysql_query($sql);
         if (!$rs) {
             trigger_error("Can not get text field data. " . $sql);
         }
         if ($lock = mysql_fetch_assoc($rs)) {
             $value = $lock['' . $this->get_db_field()];
         }
     }
     $html = new std_mod_html_output();
     $answer = '';
     if (isset($_POST[$prefix])) {
         $html->input($prefix, $_POST[$prefix], $this->read_only);
     } elseif ($value == "") {
         $html->input($prefix, $this->default_value, $this->read_only);
     } else {
         $html->input($prefix, $value, $this->read_only);
     }
     return $html->html;
     /*    
         $answer = '';
         if ($value == "")
            $answer .= '<input type="text" name="'.$prefix.'" value="'.htmlspecialchars($this->default_value).'"/><br>';
         else 
            $answer .= '<input type="text" name="'.$prefix.'" value="'.htmlspecialchars($value).'"/><br>';
         return $answer;*/
 }
示例#2
0
 function print_field_update($prefix, $parent_id = null, $area = null)
 {
     $value = null;
     if ($area) {
         $sql = "select t." . $this->get_db_field() . " from `" . DB_PREF . "" . $area->get_db_table() . "` t where " . $area->get_db_key() . " = '" . $parent_id . "' ";
         $rs = mysql_query($sql);
         if (!$rs) {
             trigger_error("Can not get text field data. " . $sql);
         }
         if ($lock = mysql_fetch_assoc($rs)) {
             $value = $lock['' . $this->get_db_field()];
         }
     }
     $html = new std_mod_html_output();
     $answer = '';
     if (isset($_POST[$prefix])) {
         if ($this->max_length) {
             $html->input($prefix, $_POST[$prefix], $this->read_only, $this->max_length);
         } else {
             $html->input($prefix, $_POST[$prefix], $this->read_only);
         }
     } else {
         if ($this->max_length) {
             $html->input($prefix, $value, $this->read_only, $this->max_length);
         } else {
             $html->input($prefix, $value, $this->read_only);
         }
     }
     return $html->html;
 }
 function print_field_update($prefix, $parent_id, $area)
 {
     $html = new std_mod_html_output();
     global $std_mod_db;
     $answer = '';
     $sql2 = "select t.translation, l.d_short, t.id as t_id, l.id as l_id from `" . DB_PREF . "translation` t, `" . DB_PREF . "language` l where t.language_id = l.id and t." . $this->translation_field . " = '" . $parent_id . "' ";
     $rs2 = mysql_query($sql2);
     if (!$rs2) {
         trigger_error("Can not get language field data. " . $sql2 . " " . mysql_error());
     } else {
         $values = array();
         while ($lock2 = mysql_fetch_assoc($rs2)) {
             $values[$lock2['l_id']] = $lock2['translation'];
         }
         $languages = $std_mod_db->languages();
         $answer .= '';
         foreach ($languages as $key => $language) {
             $sql3 = "select t.translation from `" . DB_PREF . "translation` t, `" . DB_PREF . "language` l where l.id = '" . $language['id'] . "' and t.language_id = l.id and t." . $this->translation_field . " = '" . $parent_id . "' ";
             $rs3 = mysql_query($sql3);
             $value = '';
             if ($rs3) {
                 if ($lock3 = mysql_fetch_assoc($rs3)) {
                     $value = $lock3['translation'];
                 }
             } else {
                 trigger_error("Can't get all languages " . $sql3 . " " . mysql_error());
             }
             $html->input($prefix . '_' . $language['id'], $value);
         }
     }
     return $html->html;
 }
 function print_field_update($prefix, $parent_id = null, $area = null)
 {
     $html = new std_mod_html_output();
     global $std_mod_db;
     $value = $this->default_value;
     $sql = "select * from `" . DB_PREF . "" . $area->get_db_table() . "` where " . $area->get_db_key() . " = '" . $parent_id . "' ";
     $rs = mysql_query($sql);
     if (!$rs) {
         trigger_error("Can not get text field data. " . $sql . " " . mysql_error());
     }
     if ($lock = mysql_fetch_assoc($rs)) {
         if ($lock['type'] == 'string_wysiwyg') {
             $sql = "select value from `" . DB_PREF . "par_string` where parameter_id = '" . $lock['id'] . "' ";
             $rs = mysql_query($sql);
             if (!$rs) {
                 trigger_error("Can not get text field data. " . $sql . " " . mysql_error());
             } else {
                 if ($lock2 = mysql_fetch_assoc($rs)) {
                     $value = $lock2['value'];
                 } else {
                     trigger_error("Can not get text field data. " . $sql);
                 }
             }
             $html->wysiwyg($prefix . '_string', $value);
         }
         if ($lock['type'] == 'string') {
             $sql = "select value from `" . DB_PREF . "par_string` where parameter_id = '" . $lock['id'] . "' ";
             $rs = mysql_query($sql);
             if (!$rs) {
                 trigger_error("Can not get text field data. " . $sql . " " . mysql_error());
             } else {
                 if ($lock2 = mysql_fetch_assoc($rs)) {
                     $value = $lock2['value'];
                 } else {
                     trigger_error("Can not get text field data. " . $sql);
                 }
             }
             $html->input($prefix . '_string', $value);
         }
         if ($lock['type'] == 'integer') {
             $sql = "select value from `" . DB_PREF . "par_integer` where parameter_id = '" . $lock['id'] . "' ";
             $rs = mysql_query($sql);
             if (!$rs) {
                 trigger_error("Can not get integer field data. " . $sql . " " . mysql_error());
             } else {
                 if ($lock2 = mysql_fetch_assoc($rs)) {
                     $value = $lock2['value'];
                 } else {
                     trigger_error("Can not get integer field data. " . $sql);
                 }
             }
             $html->input($prefix . '_integer', $value);
         }
         if ($lock['type'] == 'bool') {
             $sql = "select value from `" . DB_PREF . "par_bool` where parameter_id = '" . $lock['id'] . "' ";
             $rs = mysql_query($sql);
             if (!$rs) {
                 trigger_error("Can not get bool field data. " . $sql . " " . mysql_error());
             } else {
                 if ($lock2 = mysql_fetch_assoc($rs)) {
                     $value = $lock2['value'];
                 } else {
                     trigger_error("Can not get bool field data. " . $sql);
                 }
             }
             $html->input_checkbox($prefix . '_bool', $value);
         }
         if ($lock['type'] == 'textarea') {
             $sql = "select value from `" . DB_PREF . "par_string` where parameter_id = '" . $lock['id'] . "' ";
             $rs = mysql_query($sql);
             if (!$rs) {
                 trigger_error("Can not get text field data. " . $sql . " " . mysql_error());
             } else {
                 if ($lock2 = mysql_fetch_assoc($rs)) {
                     $value = $lock2['value'];
                 } else {
                     trigger_error("Can not get text field data. " . $sql);
                 }
             }
             $html->textarea($prefix . '_string', $value);
         }
         if ($lock['type'] == 'lang') {
             $answer = '';
             $sql2 = "select t.translation, l.d_long, t.id as t_id, l.id as l_id from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
             $rs2 = mysql_query($sql2);
             if (!$rs2) {
                 trigger_error("Can not get language field data. " . $sql2 . " " . mysql_error());
             } else {
                 $values = array();
                 while ($lock2 = mysql_fetch_assoc($rs2)) {
                     $values[$lock2['l_id']] = $lock2['translation'];
                 }
                 $languages = $std_mod_db->languages();
                 $answer .= '';
                 foreach ($languages as $key => $language) {
                     $sql3 = "select t.translation from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where l.id = '" . $language['id'] . "' and t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
                     $rs3 = mysql_query($sql3);
                     $value = '';
                     if ($rs3) {
                         if ($lock3 = mysql_fetch_assoc($rs3)) {
                             $value = $lock3['translation'];
                         }
                     } else {
                         trigger_error("Can't get all languages " . $sql3 . " " . mysql_error());
                     }
                     $html->html('<span class="label">' . $language['d_short'] . '</span><br />');
                     $html->input($prefix . '_' . $language['id'], $value);
                     $html->html("<br />");
                 }
             }
         }
         if ($lock['type'] == 'lang_textarea') {
             $answer = '';
             $sql2 = "select t.translation, l.d_long, t.id as t_id, l.id as l_id from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
             $rs2 = mysql_query($sql2);
             if (!$rs2) {
                 trigger_error("Can not get language field data. " . $sql2 . " " . mysql_error());
             } else {
                 $values = array();
                 while ($lock2 = mysql_fetch_assoc($rs2)) {
                     $values[$lock2['l_id']] = $lock2['translation'];
                 }
                 $languages = $std_mod_db->languages();
                 $answer .= '';
                 foreach ($languages as $key => $language) {
                     $sql3 = "select t.translation from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where l.id = '" . $language['id'] . "' and t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
                     $rs3 = mysql_query($sql3);
                     $value = '';
                     if ($rs3) {
                         if ($lock3 = mysql_fetch_assoc($rs3)) {
                             $value = $lock3['translation'];
                         }
                     } else {
                         trigger_error("Can't get all languages " . $sql3 . " " . mysql_error());
                     }
                     $html->html('<span class="label">' . $language['d_short'] . '</span><br />');
                     //	$html->html('<div class="label">');
                     $html->textarea($prefix . '_' . $language['id'], $value);
                     $html->html("<br />");
                     //$html->html('</div>');
                 }
             }
         }
         if ($lock['type'] == 'lang_wysiwyg') {
             $answer = '';
             $sql2 = "select t.translation, l.d_long, t.id as t_id, l.id as l_id from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
             $rs2 = mysql_query($sql2);
             if (!$rs2) {
                 trigger_error("Can not get language field data. " . $sql2 . " " . mysql_error());
             } else {
                 $values = array();
                 while ($lock2 = mysql_fetch_assoc($rs2)) {
                     $values[$lock2['l_id']] = $lock2['translation'];
                 }
                 $languages = $std_mod_db->languages();
                 $answer .= '';
                 foreach ($languages as $key => $language) {
                     $sql3 = "select t.translation from `" . DB_PREF . "par_lang` t, `" . DB_PREF . "language` l where l.id = '" . $language['id'] . "' and t.language_id = l.id and t.parameter_id = '" . $lock['id'] . "' ";
                     $rs3 = mysql_query($sql3);
                     $value = '';
                     if ($rs3) {
                         if ($lock3 = mysql_fetch_assoc($rs3)) {
                             $value = $lock3['translation'];
                         }
                     } else {
                         trigger_error("Can't get all languages " . $sql3 . " " . mysql_error());
                     }
                     $html->html('<span class="label">' . $language['d_short'] . '</span><br />');
                     $html->html('<div class="label">');
                     $html->wysiwyg($prefix . '_' . $language['id'], $value);
                     $html->html('</div>');
                 }
             }
         }
     }
     $html->html('<input type="hidden" name="' . $prefix . '" value="' . $lock['type'] . '" //>');
     return $html->html;
 }