本文整理汇总了PHP中CommonDBChild::getSpecificValueToSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBChild::getSpecificValueToSelect方法的具体用法?PHP CommonDBChild::getSpecificValueToSelect怎么用?PHP CommonDBChild::getSpecificValueToSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonDBChild
的用法示例。
在下文中一共展示了CommonDBChild::getSpecificValueToSelect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSpecificValueToSelect
/**
* Define how to display search field for a specific type
*
* @since version 0.84
*
* @param String $field Name of the field as define in $this->getSearchOptions()
* @param String $name Name attribute for the field to be posted (default '')
* @param Array $values Array of all values to display in search engine (default '')
* @param Array $options Options (optional)
*
* @return String Html string to be displayed for the form field
**/
public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'status':
$output = '<select name="' . $name . '">';
$output .= '<option value="waiting" ' . ($values[$field] == 'waiting' ? ' selected ' : '') . '>' . __('waiting', 'formcreator') . '</option>';
$output .= '<option value="accepted" ' . ($values[$field] == 'accepted' ? ' selected ' : '') . '>' . __('accepted', 'formcreator') . '</option>';
$output .= '<option value="refused" ' . ($values[$field] == 'refused' ? ' selected ' : '') . '>' . __('refused', 'formcreator') . '</option>';
$output .= '</select>';
return $output;
break;
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例2: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'status':
$options['value'] = $values[$field];
return self::dropdownStatus($name, $options);
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例3: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
global $DB;
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'criteria':
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
$options['value'] = $values[$field];
$options['name'] = $name;
return $rule->dropdownCriteria($options);
}
}
break;
case 'condition':
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
if (isset($values['criteria']) && !empty($values['criteria'])) {
$options['criterion'] = $values['criteria'];
}
$options['value'] = $values[$field];
$options['name'] = $name;
return $rule->dropdownConditions($generic_rule->fields["sub_type"], $options);
}
break;
case 'pattern':
if (!isset($values["criteria"]) || !isset($values["condition"])) {
return NOT_AVAILABLE;
}
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
/// TODO : manage display param to this function : need to send ot to all under functions
$rule->displayCriteriaSelectPattern($name, $values["criteria"], $values["condition"], $values[$field]);
}
}
break;
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例4: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case "sink_type":
return self::dropdownAmortType($name, $values[$field], false);
case "alert":
$options['name'] = $name;
$options['value'] = $values[$field];
return self::dropdownAlert($options);
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例5: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
global $DB;
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'field':
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
$options['value'] = $values[$field];
$options['name'] = $name;
return $rule->dropdownActions($options);
}
}
break;
case 'action_type':
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
return self::dropdownActions(array('subtype' => $generic_rule->fields["sub_type"], 'name' => $name, 'value' => $values[$field], 'alreadyused' => false, 'display' => false));
}
break;
case 'pattern':
if (!isset($values["field"]) || !isset($values["action_type"])) {
return NOT_AVAILABLE;
}
$generic_rule = new Rule();
if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
/// TODO review it : need to pass display param and others...
return $this->displayActionSelectPattern($values);
}
}
break;
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}