mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
This commit is contained in:
@@ -388,20 +388,13 @@ e107::js('footer-inline', js());
|
||||
);
|
||||
|
||||
|
||||
|
||||
public function init()
|
||||
/**
|
||||
* Automatically exectured when edit mode is active.
|
||||
*/
|
||||
public function EditObserver()
|
||||
{
|
||||
parent::EditObserver();
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->getAction() == 'edit' || $this->getAction() == 'create')
|
||||
{
|
||||
$this->fields['user_extended_struct_type']['title'] = LAN_TYPE;
|
||||
}
|
||||
|
||||
if($this->getAction() == 'edit')
|
||||
{
|
||||
$parms = e107::getDb()->retrieve('user_extended_struct', 'user_extended_struct_parms',"user_extended_struct_id = ".intval($_GET['id']));
|
||||
$tmp = explode('^,^', $parms);
|
||||
|
||||
@@ -411,6 +404,18 @@ e107::js('footer-inline', js());
|
||||
$this->fields['field_userhide']['writeParms']['default'] = $tmp[3];
|
||||
$this->fields['field_placeholder']['writeParms']['default'] = $tmp[4];
|
||||
$this->fields['field_helptip']['writeParms']['default'] = $tmp[5];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
if($this->getAction() == 'edit' || $this->getAction() == 'create')
|
||||
{
|
||||
$this->fields['user_extended_struct_type']['title'] = LAN_TYPE;
|
||||
}
|
||||
|
||||
$data = e107::getDb()->retrieve("user_extended_struct", "*", "user_extended_struct_type = 0 ORDER BY user_extended_struct_order ASC", true);
|
||||
@@ -447,7 +452,7 @@ e107::js('footer-inline', js());
|
||||
$new_data['user_extended_struct_parms'] = implode('^,^', $parms);
|
||||
}
|
||||
|
||||
if($new_data['user_extended_struct_values']==EUF_DB_FIELD)
|
||||
if($new_data['user_extended_struct_type'] == EUF_DB_FIELD)
|
||||
{
|
||||
$new_data['user_extended_struct_values'] = array($new_data['table_db'],$new_data['field_id'],$new_data['field_value'],$new_data['field_order']);
|
||||
}
|
||||
|
@@ -671,7 +671,7 @@ class e_db_mysql
|
||||
* @param boolean $multi if true, fetch all (multi mode)
|
||||
* @param string $indexField field name to be used for indexing when in multi mode
|
||||
* @param boolean $debug
|
||||
* @return array
|
||||
* @return string|array
|
||||
*/
|
||||
public function retrieve($table, $fields = null, $where=null, $multi = false, $indexField = null, $debug = false)
|
||||
{
|
||||
|
@@ -866,52 +866,12 @@ class e107_user_extended
|
||||
|
||||
case EUF_CHECKBOX : //checkboxes
|
||||
|
||||
// print_a($choices);
|
||||
if(!is_array($curval))
|
||||
{
|
||||
$curval = e107::unserialize($curval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return e107::getForm()->checkboxes($fname.'[]',$choices, $curval, array('useLabelValues'=>1));
|
||||
/*
|
||||
|
||||
foreach($choices as $choice)
|
||||
{
|
||||
$choice = trim($choice);
|
||||
|
||||
if(strpos($choice,"|")!==FALSE)
|
||||
{
|
||||
list($val,$label) = explode("|",$choice);
|
||||
}
|
||||
elseif(strpos($choice," => ")!==FALSE) // new in v2.x
|
||||
{
|
||||
list($val,$label) = explode(" => ",$choice);
|
||||
}
|
||||
else
|
||||
{
|
||||
$val = $choice;
|
||||
$label = $choice;
|
||||
}
|
||||
$label = deftrue($label, $label);
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$ret .= $frm->checkbox($fname.'[]',$val,($curval == $val), array('label'=>$label));
|
||||
}
|
||||
else
|
||||
{
|
||||
$chk = ($curval == $val)? " checked='checked' " : "";
|
||||
$ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $ret;
|
||||
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
@@ -954,14 +914,21 @@ class e107_user_extended
|
||||
|
||||
case EUF_DB_FIELD : //db_field
|
||||
|
||||
if(empty($choices))
|
||||
{
|
||||
e107::getDebug()->log("DB Field Choices is empty");
|
||||
}
|
||||
|
||||
$sql = e107::getDb('ue');
|
||||
$order = ($choices[3]) ? "ORDER BY ".$tp -> toDB($choices[3], true) : "";
|
||||
|
||||
if($sql->select($tp -> toDB($choices[0], true), $tp -> toDB($choices[1], true).",".$tp -> toDB($choices[2], true), "1 $order")){
|
||||
$choiceList = $sql->db_getList('ALL',FALSE);
|
||||
$ret = "<select id='{$fid}' {$include} name='{$fname}' {$required} >\n";
|
||||
$order = ($choices[3]) ? "ORDER BY " . $tp->toDB($choices[3], true) : "";
|
||||
|
||||
if($sql->select($tp->toDB($choices[0], true), $tp->toDB($choices[1], true) . "," . $tp->toDB($choices[2], true), "1 $order"))
|
||||
{
|
||||
$choiceList = $sql->db_getList('ALL', false);
|
||||
$ret = "<select id='{$fid}' {$include} name='{$fname}' {$required} {$title}>\n";
|
||||
$ret .= "<option value=''> </option>\n"; // ensures that the user chose it.
|
||||
|
||||
foreach($choiceList as $cArray)
|
||||
{
|
||||
$cID = trim($cArray[$choices[1]]);
|
||||
@@ -969,11 +936,16 @@ class e107_user_extended
|
||||
$sel = ($curval == $cID) ? " selected='selected' " : "";
|
||||
$ret .= "<option value='{$cID}' {$sel}>{$cText}</option>\n";
|
||||
}
|
||||
|
||||
$ret .= "</select>\n";
|
||||
|
||||
return $ret;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<span class='label label-danger'>Failed to load</span>";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EUF_TEXTAREA : //textarea
|
||||
|
Reference in New Issue
Block a user