本文整理匯總了PHP中Dict::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dict::load方法的具體用法?PHP Dict::load怎麽用?PHP Dict::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dict
的用法示例。
在下文中一共展示了Dict::load方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: form
/**
* Contruct a HTML From for a fields
*
* @param array $aRow parameter of the field
* @param string $key Name of the field
* @param string $cssClass CSS Classe for the form
* @return string
*/
public function form($aRow, $key, $cssClass)
{
global $langs, $conf;
$form = new Form($this->db);
$rtr = "";
if ($aRow->enable) {
$rtr .= '<div class="formRow elVal">' . "\n";
$label = $langs->transcountry($key, $this->Country);
if (!$label) {
$label = $langs->trans($key);
}
$rtr .= '<label for="' . $key . '">' . $label . '</label>' . "\n";
switch ($aRow->type) {
case "textarea":
$rtr .= '<textarea maxlength="' . $aRow->length . '" class="' . $cssClass . '" id="' . $key . '" name="' . $key . '" cols="1" rows="4">' . $this->{$key} . '</textarea>';
$rtr .= '<script> $(document).ready(function() { $("#' . $key . '").counter({ goal: 120 });}); </script>';
break;
case "select":
if ($cssClass == "small") {
$style = "width:200px;";
} else {
$style = "width:400px;";
}
$rtr .= '<select data-placeholder="' . $langs->trans($key) . '…" class="chzn-select expand" style="' . $style . '" id="' . $key . '" name="' . $key . '" >';
if (isset($aRow->dict)) {
require_once DOL_DOCUMENT_ROOT . "/admin/class/dict.class.php";
// load from dictionnary
try {
$dict = new Dict($this->db);
$values = $dict->load($aRow->dict, true);
//filter for country
foreach ($values->values as $idx => $row) {
if (empty($row->pays_code) || $this->Country == $row->pays_code) {
$aRow->values[$idx] = $row;
}
}
} catch (Exception $e) {
dol_print_error('', $e->getMessage());
}
}
if (empty($this->{$key})) {
$this->{$key} = $aRow->default;
}
foreach ($aRow->values as $idx => $row) {
if ($row->enable) {
$rtr .= '<option value="' . $idx . '"';
if ($this->{$key} == $idx) {
$rtr .= ' selected="selected"';
}
$rtr .= '>';
if (isset($row->label)) {
$rtr .= $langs->trans($row->label);
} else {
$rtr .= $langs->trans($idx);
}
$rtr .= '</option>';
}
}
$rtr .= '</select>';
break;
case "checkbox":
if (isset($this->{$key})) {
$value = $this->{$key};
} else {
$value = $aRow->default;
}
if ($value) {
$rtr .= '<input type="checkbox" id="' . $key . '" name="' . $key . '" checked="checked"/>';
} else {
$rtr .= '<input type="checkbox" id="' . $key . '" name="' . $key . '" />';
}
break;
case "uploadfile":
$rtr .= '<input type="file" class="flat" name="' . $key . '" id="' . $key . '">';
break;
default:
if (isset($aRow->mask)) {
$rtr .= '<input type="text" maxlength="' . $aRow->length . '" id="' . $key . '" name="' . $key . '" value="' . $this->{$key} . '" class="input-text ' . $aRow->css . " " . $cssClass . '" mask="' . $key . '"/>' . "\n";
} else {
$rtr .= '<input type="text" maxlength="' . $aRow->length . '" id="' . $key . '" name="' . $key . '" value="' . $this->{$key} . '" class="input-text ' . $aRow->css . " " . $cssClass . '"/>' . "\n";
}
}
$rtr .= '</div>' . "\n";
}
return $rtr;
}