本文整理汇总了PHP中CMbArray::extract方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::extract方法的具体用法?PHP CMbArray::extract怎么用?PHP CMbArray::extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbArray
的用法示例。
在下文中一共展示了CMbArray::extract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValue
/**
* @see parent::getValue()
*/
function getValue($object, $smarty = null, $params = array())
{
$value = $object->{$this->fieldName};
$decimals = CMbArray::extract($params, "decimals", $this->decimals);
$empty = CMbArray::extract($params, "empty");
return CSmartyMB::currency($value, $decimals, $this->precise, $empty);
}
示例2: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$field = CMbString::htmlSpecialChars($this->fieldName);
$value = CMbString::htmlSpecialChars($value);
$class = CMbString::htmlSpecialChars("{$className} {$this->prop}");
$form = CMbArray::extract($params, "form");
$extra = CMbArray::makeXmlAttributes($params);
return "<input type=\"tel\" name=\"{$field}\" value=\"{$value}\" class=\"{$class} styled-element\" {$extra} />";
}
示例3: updateFormFields
/**
* @see parent::updateFormFields()
*/
function updateFormFields()
{
$this->_query_params_get = $get = json_decode($this->query_params_get, true);
$this->_query_params_post = $post = json_decode($this->query_params_post, true);
$this->_session_data = $session = json_decode($this->session_data, true);
$get = is_array($get) ? $get : array();
$post = is_array($post) ? $post : array();
$this->_module = CValue::first(CMbArray::extract($get, "m"), CMbArray::extract($post, "m"));
$this->_action = CValue::first(CMbArray::extract($get, "tab"), CMbArray::extract($get, "a"), CMbArray::extract($post, "dosql"));
}
示例4: getValue
/**
* @see parent::getValue()
*/
function getValue($object, $smarty = null, $params = array())
{
if ($smarty) {
include_once $smarty->_get_plugin_filepath('modifier', 'date_format');
}
$propValue = $object->{$this->fieldName};
$format = CMbArray::extract($params, "format", CAppUI::conf("datetime"));
if ($format === "relative") {
$relative = CMbDate::relative($propValue, CMbDT::dateTime());
return $relative["count"] . " " . CAppUI::tr($relative["unit"] . ($relative["count"] > 1 ? "s" : ""));
}
$date = CMbArray::extract($params, "date");
if ($date && CMbDT::date($propValue) == $date) {
$format = CAppUI::conf("time");
}
return $propValue && $propValue != "0000-00-00 00:00:00" ? smarty_modifier_date_format($propValue, $format) : "";
}
示例5: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$field = CMbString::htmlSpecialChars($this->fieldName);
$form = CMbArray::extract($params, "form");
$extra = CMbArray::makeXmlAttributes($params);
$readonly = CMbArray::extract($params, "readonly");
$default_color = $this->default ? $this->default : "ffffff";
$reset_value = $this->notNull ? $default_color : "";
$bg_reset = $reset_value ? "#{$reset_value}" : "transparent";
$value = !$value && ($this->notNull || $this->default) ? $default_color : $value;
$sHtml = "\n <input type=\"text\" class=\"color_picker\" name=\"{$field}\" value=\"{$value}\" {$extra} />\n <button type=\"button\" onclick=\"var elem = \$(this).previous('input'); \$V(elem, '{$reset_value}', true); elem.setStyle({backgroundColor: '{$bg_reset}'});\" class='cancel notext'></button>\n ";
if ($form && !$readonly) {
$js_params = "{}";
if (!$this->notNull) {
$js_params = "{required:false}";
}
$sHtml .= "<script type=\"text/javascript\">\n Main.add(function(){\n var _e = getForm('" . $form . "').elements['" . $field . "'];\n new jscolor.color(_e, {$js_params});\n })\n </script>";
}
return $sHtml;
}
示例6: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$form = CMbArray::extract($params, "form");
// needs to be extracted
$field = CMbString::htmlSpecialChars($this->fieldName);
$extra = CMbArray::makeXmlAttributes($params);
$sHtml = '<input type="password" name="' . $field . '" class="' . CMbString::htmlSpecialChars(trim($className . ' ' . $this->prop)) . ' styled-element" ';
if ($this->revealable) {
$sHtml .= ' value="' . CMbString::htmlSpecialChars($value) . '" ';
}
$sHtml .= $extra . ' />';
if ($this->revealable) {
$sHtml .= '<button class="lookup notext" type="button" onclick="var i=$(this).previous(\'input\');i.type=(i.type==\'password\')?\'text\':\'password\'"></button>';
}
if ($this->randomizable) {
$random_call = "getRandomPassword('{$object->_class}', '{$field}');";
$title = CAppUI::tr("common-action-Get random password");
$sHtml .= '<button class="change notext" type="button" onclick="' . $random_call . '" title="' . $title . '"></button>';
}
$sHtml .= '<span id="' . $field . '_message"></span>';
return $sHtml;
}
示例7: __construct
/**
* The constructor
*
* @param string $rooturl The URL of the wsdl file
* @param string $type The type of exchange
* @param array $options An array of options
* @param boolean $loggable True if you want to log all the exchanges with the web service
* @param string $local_cert Path of the certifacte
* @param string $passphrase Pass phrase for the certificate
* @param bool $safe_mode Safe mode
* @param boolean $verify_peer Require verification of SSL certificate used
* @param string $cafile Location of Certificate Authority file on local filesystem
* @param String $wsdl_external Location of external wsdl
* @param int $socket_timeout Default timeout (in seconds) for socket based streams
*
* @throws CMbException
*
* @return CMbSOAPClient
*/
function __construct($rooturl, $type = null, $options = array(), $loggable = null, $local_cert = null, $passphrase = null, $safe_mode = false, $verify_peer = false, $cafile = null, $wsdl_external = null, $socket_timeout = null)
{
$this->return_mode = CMbArray::extract($options, "return_mode", "normal");
$this->xop_mode = CMbArray::extract($options, "xop_mode", false);
$this->use_tunnel = CMbArray::extract($options, "use_tunnel", false);
$this->wsdl_url = $rooturl;
if ($loggable) {
$this->loggable = $loggable;
}
if ($type) {
$this->type_echange_soap = $type;
}
$login = CMbArray::get($this->options, "login");
$password = CMbArray::get($this->options, "password");
$check_option["local_cert"] = $local_cert;
$check_option["ca_cert"] = $cafile;
$check_option["passphrase"] = $passphrase;
$check_option["username"] = $login;
$check_option["password"] = $password;
$this->check_option = $check_option;
if (!$safe_mode) {
if (!($html = CHTTPClient::checkUrl($this->wsdl_url, $this->check_option, true))) {
$this->soap_client_error = true;
throw new CMbException("CSourceSOAP-unable-to-parse-url", $this->wsdl_url);
}
if (strpos($html, "<?xml") === false) {
$this->soap_client_error = true;
throw new CMbException("CSourceSOAP-wsdl-invalid");
}
}
// Ajout des options personnalisées
$options = array_merge($options, array("connection_timeout" => CAppUI::conf("webservices connection_timeout")));
if (CAppUI::conf("webservices trace")) {
$options = array_merge($options, array("trace" => true));
}
// Authentification HTTP
if ($local_cert) {
$this->local_cert = $local_cert;
$options = array_merge($options, array("local_cert" => $local_cert));
}
if ($passphrase) {
$this->passphrase = $passphrase;
$options = array_merge($options, array("passphrase" => $passphrase));
}
if (array_key_exists('stream_context', $options)) {
$context = $options['stream_context'];
} else {
$context = stream_context_create();
}
// Authentification SSL
if ($verify_peer && $cafile) {
$this->ca_info = $cafile;
stream_context_set_option($context, "ssl", "verify_peer", $verify_peer);
stream_context_set_option($context, "ssl", "cafile", $cafile);
}
// Délai maximal d'attente pour la lecture
$socket_timeout = $socket_timeout ? $socket_timeout : CAppUI::conf("webservices response_timeout");
if ($socket_timeout) {
ini_set("default_socket_timeout", $socket_timeout);
}
$options = array_merge($options, array("stream_context" => $context));
$this->options = $options;
if ($wsdl_external) {
$this->wsdl_url = $wsdl_external;
}
parent::__construct($this->wsdl_url, $options);
}
示例8: CUser
$prof = $user->profile_id ? CUser::get($user->profile_id) : new CUser();
if ($user_id == "default") {
$user->_id = null;
}
$prefvalues = array("default" => CPreferences::get(null, true), "template" => $user->profile_id ? CPreferences::get($user->profile_id, true) : array(), "user" => $user->_id !== "" ? CPreferences::get($user->_id, true) : array());
// common sera toujours au debut
$prefs = array("common" => array());
// Classement par module et par permission fonctionnelle
CPreferences::loadModules(true);
foreach (CPreferences::$modules as $modname => $prefnames) {
$module = CModule::getActive($modname);
$canRead = $module ? CPermModule::getPermModule($module->_id, PERM_READ, $user_id) : false;
if ($modname == "common" || $user_id == "default" || $canRead) {
$prefs[$modname] = array();
foreach ($prefnames as $prefname) {
$prefs[$modname][$prefname] = array("default" => CMbArray::extract($prefvalues["default"], $prefname), "template" => CMbArray::extract($prefvalues["template"], $prefname), "user" => CMbArray::extract($prefvalues["user"], $prefname));
}
}
}
// Warning: user clone necessary!
// Some module index change $user global
$user_clone = $user;
// Chargement des modules
$modules = CPermModule::getVisibleModules();
foreach ($modules as $module) {
// Module might not be present
@(include "./modules/{$module->mod_name}/index.php");
}
$user = $user_clone;
$smarty = new CSmartyDP();
$smarty->assign("user", $user);
示例9: doSingle
/**
* Do action, single object mode
*
* @param bool $reinstanciate_objects Make new instances of the object (don't use the ones instanciated in the constructor)
*
* @return void
*/
function doSingle($reinstanciate_objects)
{
$this->doBind($reinstanciate_objects);
if (CMbArray::extract($this->request, 'del')) {
$this->doDelete();
} else {
$this->doStore();
}
}
示例10: mb_colonne
function mb_colonne($params, &$smarty)
{
$class = CMbArray::extract($params, "class", null, true);
$field = CMbArray::extract($params, "field", null, true);
$order_col = CMbArray::extract($params, "order_col", null, true);
$order_way = CMbArray::extract($params, "order_way", null, true);
$order_suffixe = CMbArray::extract($params, "order_suffixe", "", false);
$url = CMbArray::extract($params, "url", null, false);
$function = CMbArray::extract($params, "function", null, false);
$label = CMbArray::extract($params, "label", null, false);
$sHtml = "<label for=\"{$field}\" title=\"" . CAppUI::tr("{$class}-{$field}-desc") . "\">";
$sHtml .= $label ? $label : CAppUI::tr("{$class}-{$field}-court");
$sHtml .= "</label>";
$css_class = $order_col == $field ? "sorted" : "sortable";
$order_way_inv = $order_way == "ASC" ? "DESC" : "ASC";
if ($url) {
if ($css_class == "sorted") {
return "<a class='{$css_class} {$order_way}' href='{$url}&order_col{$order_suffixe}={$order_col}&order_way{$order_suffixe}={$order_way_inv}'>{$sHtml}</a>";
}
if ($css_class == "sortable") {
return "<a class='{$css_class}' href='{$url}&order_col{$order_suffixe}={$field}&order_way{$order_suffixe}=ASC'>{$sHtml}</a>";
}
}
if ($function) {
if ($css_class == "sorted") {
return "<a class='{$css_class} {$order_way}' onclick=\"{$function}('{$order_col}','{$order_way_inv}');\">{$sHtml}</a>";
}
if ($css_class == "sortable") {
return "<a class='{$css_class}' onclick=\"{$function}('{$field}','ASC');\">{$sHtml}</a>";
}
}
}
示例11: getPatientState
/**
* Get the patient state
*
* @param DOMNode $node Node
* @param CPatient $newPatient Patient
*
* @return void
*/
function getPatientState(DOMNode $node, CPatient $newPatient)
{
if ($states = $this->queryNodes("PID.32", $node)) {
$list_state = array();
foreach ($states as $_state) {
$list_state[] = $this->queryTextNode(".", $_state);
}
$state = CMbArray::extract($list_state, 0);
if (!$state) {
return;
}
if ($state == "CACH") {
$newPatient->vip = true;
$status = CMbArray::get($list_state, 1);
if ($status) {
$state = $status;
}
} else {
if (in_array("CACH", $list_state)) {
$newPatient->vip = true;
}
}
$newPatient->_status_no_guess = true;
$newPatient->status = $state;
}
}
示例12: getLabelForAttribute
/**
* @see parent::getLabelForAttribute()
*/
function getLabelForAttribute($object, &$params)
{
$typeEnum = CMbArray::extract($params, "typeEnum", "radio");
switch ($typeEnum) {
//case "radio": return "{$this->fieldName}_1";
case "checkbox":
return "__{$this->fieldName}";
default:
case "radio":
case "select":
return $this->fieldName;
}
}
示例13: testExtract
public function testExtract()
{
$array = array("key" => "val", "key2" => "val2");
$this->assertEquals("val", $this->stub->extract($array, "key"));
$this->assertNull($this->stub->extract($array, "notAkey"));
}
示例14: getFormElementDateTime
/**
* Get an HTML form datetime input corresponding to the bound object value
*
* @param object $object Object holding the field
* @param array $params Extra parameters
* @param string $value The actual value
* @param string $className Extra CSS class name
* @param string $format Optional datetime format
*
* @return string HTML form datetime string
*/
function getFormElementDateTime($object, $params, $value, $className, $format = "%d/%m/%Y %H:%M")
{
if ($object->_locked) {
$params["readonly"] = "readonly";
}
$class = CMbString::htmlSpecialChars(trim("{$className} {$this->prop}"));
$field = CMbString::htmlSpecialChars($this->fieldName);
// Format the date
$date = "";
if ($value && $value != '0000-00-00' && $value != '00:00:00' && $value != '0000-00-00 00:00:00') {
$date = $this instanceof CDateSpec && $this->progressive ? $this->getValue($object, null, $params) : CMbDT::format($value, $format);
}
$form = CMbArray::extract($params, "form");
$register = CMbArray::extract($params, "register");
$style = CMbArray::extract($params, "style");
$tabindex = CMbArray::extract($params, "tabindex");
$readonly = CMbArray::get($params, "readonly");
$extra = CMbArray::makeXmlAttributes($params);
$html = array();
$html[] = '<input name="' . $field . '_da" type="text" value="' . $date . '" class="' . $class . ' styled-element"
readonly="readonly" ' . (isset($tabindex) ? 'tabindex="' . $tabindex . '" ' : '') . ' style="' . $style . '" />';
$html[] = '<input name="' . $field . '" type="hidden" value="' . $value . '" class="' . $class . '" ' . $extra . ' data-visual-element="' . $field . '_da" />';
if ($form && !$readonly && ($register || $this instanceof CTimeSpec)) {
$register = $this instanceof CDateSpec && $this->progressive ? 'regProgressiveField' : 'regField';
$html[] = '<script type="text/javascript">
Main.add(function(){Calendar.' . $register . '(getForm("' . $form . '").elements["' . $field . '"])})
</script>';
}
return implode("\n", $html);
}
示例15: foreach
/**
* $Id: do_configure.php 21614 2014-01-08 16:57:12Z flaviencrochard $
*
* @package Mediboard
* @subpackage System
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 21614 $
*/
global $mbpath, $dPconfig;
CCanDo::checkAdmin();
$mbpath = "";
CMbArray::extract($_POST, "m");
CMbArray::extract($_POST, "dosql");
CMbArray::extract($_POST, "suppressHeaders");
$ajax = CMbArray::extract($_POST, "ajax");
$config_db = CAppUI::conf("config_db");
if ($config_db) {
$configs = $_POST;
// Ne pas inclure de config relatives aux bases de données
foreach ($_POST as $key => $_config) {
if (in_array($key, CMbConfig::$forbidden_values) || $key == "db") {
unset($configs[$key]);
} else {
unset($_POST[$key]);
}
}
$configs = array_map_recursive('stripslashes', $configs);
// DB Version
$inserts = array();
$ds = CSQLDataSource::get("std");