示例#1
0
function sendCallDoneInfo($request)
{
    $callduration = getValueFromArray($request, 'callduration');
    $status = getValueFromArray($request, 'status');
    $data = getValueFromArray($request, 'data');
    $message = getValueFromArray($request, 'message');
}
示例#2
0
 protected function _isValid($value, $params)
 {
     $result = isValidEmail($value, getValueFromArray($params, Flag::VALIDATE_DOMAIN, false));
     if (!$result) {
         Factory::log()->warn("O e-mail {$value} não é um e-mail válido");
         return false;
     }
     return true;
 }
示例#3
0
 /**
  * 
  * @param array $params
  * @return mixed DAO se a Flag::DAO_NAME for setada ou null caso contrário
  */
 public function getDAO($params)
 {
     $daoname = getValueFromArray($params, Flag::DAO_NAME, "");
     if (empty($daoname)) {
         Factory::log()->fatal('É necessário informar o nome do DAO... use Flag::DAO_NAME no parameter!');
         return null;
     }
     return Factory::DAO($daoname);
 }
示例#4
0
 /**
  * Para efeitos de sanitização se $params['value'] não for vazio, concatena-o ao final do conteúdo
  * @return string
  */
 protected function _sanitize($value, $params)
 {
     $value = parent::_sanitize($value, $params);
     $extra = getValueFromArray($params, 'value', '');
     if (empty($extra)) {
         return $value;
     }
     return $value . $extra;
 }
示例#5
0
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     $params = $this->normalizeParams($params);
     $attr = $this->getHTMLAttributes($attr, $params);
     $enum = $this->getEnum($params);
     $options = $enum->labels();
     if (!getValueFromArray($params, Flag::REQUIRED, false)) {
         array_unshift($options, getValueFromArray($params, Flag::PLACEHOLHER, 'Escolha uma opção'));
     }
     return HTML::select($name, $options, $value, $attr, $name . '_id');
 }
function sendCallDoneInfo($request, $stage)
{
    global $apiurl;
    global $agentid;
    $callduration = getValueFromArray($request, 'callduration');
    $status = getValueFromArray($request, 'status');
    $recordurl = getValueFromArray($request, 'data');
    $message = getValueFromArray($request, 'message');
    $data = array("callduration" => $callduration, "status" => $status, "recordurl" => $data, "message" => $message, "stage" => $stage, "agent" => $agentid, "type" => "nextcall");
    curlPost($apiurl . '/api/agent.php', $data);
}
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     $params = $this->normalizeParams($params);
     if (empty($value)) {
         $attr['value'] = getValueFromArray($params, Flag::DEFAULT_VALUE, '');
     } else {
         $attr['value'] = $value;
     }
     $attr = $this->getHTMLAttributes($attr, $params);
     return HTML::input($name, $attr, $name . '_id', $this->getHTMLInputType());
 }
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     $params = $this->normalizeParams($params);
     if (!$this->_isValid($value)) {
         $value = getValueFromArray($params, Flag::DEFAULT_VALUE);
     }
     $attr = $this->getHTMLAttributes($attr, $params);
     $options = array('true' => getValueFromArray($params, Flag::TRUE_LABEL, 'Verdadeiro'), 'false' => getValueFromArray($params, Flag::FALSE_LABEL, 'Falso'));
     if (!getValueFromArray($params, Flag::REQUIRED, false)) {
         array_unshift($options, '');
     }
     return HTML::select($name, $options, var_export($value, true), $attr, $name . '_id');
 }
示例#9
0
 public function testGetValueFromArray()
 {
     $vetor = array('a' => 1, 'b' => '2', 'c' => true, 'd' => false);
     foreach ($vetor as $k => $v) {
         $this->assertEquals($v, getValueFromArray($vetor, $k));
         $this->assertEquals($v, getValueFromArray($vetor, $k, 'xyz'));
     }
     $this->assertNull(getValueFromArray($vetor, 'xyz'));
     $this->assertEquals('default value', getValueFromArray($vetor, 'xyz', 'default value'));
     $this->assertEquals(true, getValueFromArray($vetor, 'xyz', true));
     $this->assertEquals(false, getValueFromArray($vetor, 'xyz', false));
     $this->assertEquals('', getValueFromArray($vetor, 'xyz', ''));
 }
 /**
  * 
  * nao usar por enquanto, falta definir a forma de receber os dados
  * na submissão
  */
 protected function chosen($name, $value, $params, $attr)
 {
     MemoryPage::addCss("static/bstemplates/plugins/chosen/chosen.min.css");
     MemoryPage::addJs("static/bstemplates/plugins/chosen/chosen.jquery.min.js");
     $params = $this->normalizeParams($params);
     $dao = $this->getDAO($params);
     $dao_label = getValueFromArray($params, Flag::DAO_LABEL, Flag::DAO_LABEL);
     $dao_value = getValueFromArray($params, Flag::DAO_VALUE, Flag::DAO_VALUE);
     $dados = $dao->listAll();
     //$attr["value"] = $value;
     //$attr = $this->getHTMLAttributes($attr, $params);
     $template = PATH_APP . '/view/bstemplates/multiselect.mustache';
     $vetor["multiselect"] = ["placeholder" => getValueFromArray($params, Flag::PLACEHOLHER, "Escolha uma opção"), 'options' => $dados];
     return Template::singleton()->renderHTML(file_get_contents($template), $vetor);
 }
示例#11
0
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     $params = $this->normalizeParams($params);
     $attr = $this->getHTMLAttributes($attr, $params);
     if (empty($value)) {
         $value = getValueFromArray($params, Flag::DEFAULT_VALUE, '');
     }
     $maxlenght = getValueFromArray($params, Flag::MAXLENGHT, false);
     if ($maxlenght) {
         MemoryPage::addJs("static/js/bootstrap-maxlength.js");
         MemoryPage::addJs("static/js/autosize.v3.js");
         $extra = ["maxlength" => $maxlenght, "data-limite-caracteres" => $maxlenght];
         $attr = array_merge($attr, $extra);
     }
     return HTML::textarea($name, $attr, $name . '_id', $value);
 }
示例#12
0
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     $params = $this->normalizeParams($params);
     if (!$this->_isValid($value)) {
         $value = getValueFromArray($params, Flag::DEFAULT_VALUE);
     }
     $attr = $this->getHTMLAttributes($attr, $params);
     if (is_bool($value) and $value) {
         $attr["checked"] = "checked";
     }
     $element = "<div class='checkbox'>";
     $element .= "<label for='{$name}_id' >";
     $element .= HTML::input($name, $attr, $name . '_id', 'checkbox');
     $element .= getValueFromArray($params, Flag::LABEL) . "</label></div>";
     return $element;
 }
 /**
  * Retorna o html para renderizar o elemento na página
  * 
  * @param  string $name   O nome do componente
  * @param  string $value  O caminho da imagem
  * @param  array  $params Parâmetros utilizados com as Flag::CONSTANTES
  * @param  array  $attr   Atributos html para o elemento
  * @return string         Retorna o html para o elemento
  */
 public function getHTMLEditable($name, $value, $params, $attr = array())
 {
     MemoryPage::addCss('static/css/page/filemanager.css');
     MemoryPage::addJs("js/modal-fileupload.js");
     MemoryPage::addJs("static/plugin/bootstrap-fileinput-master/js/fileinput.min.js");
     MemoryPage::addCss('static/plugin/bootstrap-fileinput-master/css/fileinput.min.css');
     $params = $this->normalizeParams($params);
     $link = 'filemanager/index?path=' . getValueFromArray($params, Flag::MOVE_TO, 'image/') . '&header=false';
     $linkextra = ['data-toggle' => 'modal', 'data-target' => '#myFileUpload', 'data-up-action' => 'fileupload', 'data-hiddenid' => $name . '_id', 'data-imgid' => $name . '_img_id', 'class' => 'filemanager-action-link'];
     $linkextra = array_merge($linkextra, $attr);
     $imgattr = ['class' => 'imgfile img-responsive', 'id' => $name . '_img_id'];
     $hasOrdenator = getValueFromArray($params, Flag::FILEIMAGE_HAS_ORDENATOR, false);
     $placeholder = '<small>' . getValueFromArray($params, Flag::PLACEHOLHER, '') . '</small>';
     if (empty($value)) {
         $helpText = getValueFromArray($params, Flag::FILEIMAGE_HELP_TEXT, false);
         if (!$helpText) {
             $helpText = 'Adicionar imagem';
         }
         $noimg = "";
         $showImgComponent = getValueFromArray($params, Flag::FILEIMAGE_SHOW_IMGCOMPONENT, true);
         if ($showImgComponent) {
             $noimg = HTML::img('image/icons/img-icon.png', 'Nenhuma imagem selecionada', $imgattr);
             $img = $noimg . HTML::link($link, $helpText, 'Adicionar imagem', $linkextra);
         } else {
             $img = HTML::link($link, $noimg . $helpText, 'Adicionar imagem', $linkextra);
         }
         if ($hasOrdenator) {
             $ordem = $linkextra["data-ordem"];
             $paginaformandoid = isset($linkextra["data-pagina_id"]) ? $linkextra["data-pagina_id"] : '';
             $img .= "<div class='fileimage-ordem' title='ordem da imagem nesta página personalizada'>{$ordem}</div>";
             $img .= "<div class='glyphicon glyphicon-trash unselect' \n                        data-ordem='" . $ordem . "' data-paginaformando_id=' " . $paginaformandoid . " '   style='display:none;'\n                        title='clique aqui para remover esta imagem!'></div>";
         }
     } else {
         $img = HTML::img($value, 'Imagem selecionada', $imgattr);
         $img .= HTML::link($link, 'Alterar imagem', 'Trocar a imagem', $linkextra);
         if ($hasOrdenator) {
             $ordem = $linkextra["data-ordem"];
             $paginaformandoid = isset($linkextra["data-pagina_id"]) ? $linkextra["data-pagina_id"] : '';
             $img .= "<div class='fileimage-ordem' title='ordem da imagem nesta página personalizada'>{$ordem}</div>";
             $img .= "<div class='glyphicon glyphicon-trash unselect' \n                        data-ordem='" . $ordem . "' data-paginaformando_id=' " . $paginaformandoid . " '   \n                        title='clique aqui para remover esta imagem!'></div>";
         }
     }
     return $placeholder . $img . HTML::input($name, array('value' => $value), $name . '_id', 'hidden');
 }
示例#14
0
 /**
  * Criar um Expression
  * @param array $parts Contém um array com as seguintes chaves
  *      where => wherearray ou um objeto Where para condição da consulta
  *      orderBy => Array no formado order by
  *      limit => Limite
  *      offset => Início
  *      groupBy => Lista de campos para agrupamento
  *      having => wherearray ou um objeto Where para condição do agrupamento
  */
 public function __construct(array $parts = array())
 {
     $this->setWhere(getValueFromArray($parts, 'where', array()));
     $orderBy = getValueFromArray($parts, 'orderBy', array());
     if (!is_array($orderBy)) {
         $orderBy = array($orderBy);
     }
     foreach ($orderBy as $k => $v) {
         if (is_numeric($k)) {
             $this->addOrderBy($v);
         } else {
             $this->addOrderBy($k, $v);
         }
     }
     $this->setGroupBy(getValueFromArray($parts, 'groupBy', array()));
     $this->limit = getValueFromArray($parts, 'limit');
     $this->offset = getValueFromArray($parts, 'offset');
     $this->setHaving(getValueFromArray($parts, 'having', array()));
 }
 function getFromDB($dataSourceName)
 {
     global $globalDataSource, $globalOptions, $globalDBSpecs, $globalDebug;
     $filePath = $this->dbSettings->getCriteriaValue('target');
     if (substr_count($filePath, '../') > 2) {
         $this->logger->setErrorMessage("You can't access files in inhibit area: {$dataSourceName}.");
         return null;
     }
     $fileContent = file_get_contents($filePath);
     if ($fileContent === false) {
         $this->logger->setErrorMessage("The 'target' parameter doesn't point the valid file path in context: {$dataSourceName}.");
         return null;
     }
     eval(str_replace("<?php", "", str_replace("?>", "", str_replace("IM_Entry", "IM_Dummy_Entry", $fileContent))));
     $result = array();
     $seq = 0;
     switch ($dataSourceName) {
         case 'contexts':
             foreach ($globalDataSource as $context) {
                 $result[] = array('id' => $seq, 'name' => getValueFromArray($context, 'name'), 'table' => getValueFromArray($context, 'table'), 'view' => getValueFromArray($context, 'view'), 'records' => getValueFromArray($context, 'records'), 'paging' => getValueFromArray($context, 'paging'), 'key' => getValueFromArray($context, 'key'), 'sequence' => getValueFromArray($context, 'sequence'), 'extending-class' => getValueFromArray($context, 'extending-class'), 'protect-writing' => getValueFromArray($context, 'protect-writing'), 'protect-reading' => getValueFromArray($context, 'protect-reading'), 'db-class' => getValueFromArray($context, 'db-class'), 'dsn' => getValueFromArray($context, 'dsn'), 'option' => getValueFromArray($context, 'option'), 'database' => getValueFromArray($context, 'database'), 'user' => getValueFromArray($context, 'user'), 'password' => getValueFromArray($context, 'password'), 'server' => getValueFromArray($context, 'server'), 'port' => getValueFromArray($context, 'port'), 'protocol' => getValueFromArray($context, 'protocol'), 'datatype' => getValueFromArray($context, 'datatype'), 'cache' => getValueFromArray($context, 'cache'), 'post-reconstruct' => getValueFromArray($context, 'post-reconstruct'), 'post-dismiss-message' => getValueFromArray($context, 'post-dismiss-message'), 'post-move-url' => getValueFromArray($context, 'post-move-url'), 'repeat-control' => getValueFromArray($context, 'repeat-control'), 'post-repeater' => getValueFromArray($context, 'post-repeater'), 'post-enclosure' => getValueFromArray($context, 'post-enclosure'), 'authentication-media-handling' => getValueFromArray($context, 'authentication', 'media-handling'), 'authentication-all-user' => getValueFromArray($context, 'authentication', 'all', 'user'), 'authentication-all-group' => getValueFromArray($context, 'authentication', 'all', 'group'), 'authentication-all-target' => getValueFromArray($context, 'authentication', 'all', 'target'), 'authentication-all-field' => getValueFromArray($context, 'authentication', 'all', 'field'), 'authentication-load-user' => getValueFromArray($context, 'authentication', 'load', 'user'), 'authentication-load-group' => getValueFromArray($context, 'authentication', 'load', 'group'), 'authentication-load-target' => getValueFromArray($context, 'authentication', 'load', 'target'), 'authentication-load-field' => getValueFromArray($context, 'authentication', 'load', 'field'), 'authentication-update-user' => getValueFromArray($context, 'authentication', 'update', 'user'), 'authentication-update-group' => getValueFromArray($context, 'authentication', 'update', 'group'), 'authentication-update-target' => getValueFromArray($context, 'authentication', 'update', 'target'), 'authentication-update-field' => getValueFromArray($context, 'authentication', 'update', 'field'), 'authentication-new-user' => getValueFromArray($context, 'authentication', 'new', 'user'), 'authentication-new-group' => getValueFromArray($context, 'authentication', 'new', 'group'), 'authentication-new-target' => getValueFromArray($context, 'authentication', 'new', 'target'), 'authentication-new-field' => getValueFromArray($context, 'authentication', 'new', 'field'), 'authentication-delete-user' => getValueFromArray($context, 'authentication', 'delete', 'user'), 'authentication-delete-group' => getValueFromArray($context, 'authentication', 'delete', 'group'), 'authentication-delete-target' => getValueFromArray($context, 'authentication', 'delete', 'target'), 'authentication-delete-field' => getValueFromArray($context, 'authentication', 'delete', 'field'));
                 $seq++;
             }
             break;
         case 'relation':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['relation'])) {
                 foreach ($globalDataSource[$contextID]['relation'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'foreign-key' => getValueFromArray($rel, 'foreign-key'), 'join-field' => getValueFromArray($rel, 'join-field'), 'operator' => getValueFromArray($rel, 'operator'));
                     $seq++;
                 }
             }
             break;
         case 'query':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['query'])) {
                 foreach ($globalDataSource[$contextID]['query'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'), 'operator' => getValueFromArray($rel, 'operator'));
                     $seq++;
                 }
             }
             break;
         case 'sort':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['sort'])) {
                 foreach ($globalDataSource[$contextID]['sort'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'direction' => getValueFromArray($rel, 'direction'));
                     $seq++;
                 }
             }
             break;
         case 'default-values':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['default-values'])) {
                 foreach ($globalDataSource[$contextID]['default-values'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'));
                     $seq++;
                 }
             }
             break;
         case 'validation':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['validation'])) {
                 foreach ($globalDataSource[$contextID]['validation'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'rule' => getValueFromArray($rel, 'rule'), 'message' => getValueFromArray($rel, 'message'));
                     $seq++;
                 }
             }
             break;
         case 'script':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['script'])) {
                 foreach ($globalDataSource[$contextID]['script'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'db-operation' => getValueFromArray($rel, 'db-operation'), 'situation' => getValueFromArray($rel, 'situation'), 'definition' => getValueFromArray($rel, 'definition'));
                     $seq++;
                 }
             }
             break;
         case 'global':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['global'])) {
                 foreach ($globalDataSource[$contextID]['global'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'db-operation' => getValueFromArray($rel, 'db-operation'), 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'));
                     $seq++;
                 }
             }
             break;
         case 'file-upload':
             $contextID = $this->dbSettings->getForeignKeysValue('id');
             if (isset($globalDataSource[$contextID]['file-upload'])) {
                 foreach ($globalDataSource[$contextID]['file-upload'] as $rel) {
                     $result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'context' => getValueFromArray($rel, 'context'));
                     $seq++;
                 }
             }
             break;
         case 'options':
             $result[] = array('id' => $seq, 'separator' => getValueFromArray($globalOptions, 'separator'), 'transaction' => getValueFromArray($globalOptions, 'transaction'), 'media-root-dir' => getValueFromArray($globalOptions, 'media-root-dir'), 'media-context' => getValueFromArray($globalOptions, 'media-context'), 'authentication-user-table' => getValueFromArray($globalOptions, 'authentication', 'user-table'), 'authentication-group-table' => getValueFromArray($globalOptions, 'authentication', 'group-table'), 'authentication-corresponding-table' => getValueFromArray($globalOptions, 'authentication', 'corresponding-table'), 'authentication-challenge-table' => getValueFromArray($globalOptions, 'authentication', 'challenge-table'), 'authentication-authexpired' => getValueFromArray($globalOptions, 'authentication', 'authexpired'), 'authentication-realm' => getValueFromArray($globalOptions, 'authentication', 'realm'), 'authentication-email-as-username' => getValueFromArray($globalOptions, 'authentication', 'email-as-username'));
             $seq++;
             break;
         case 'aliases':
             if (isset($globalOptions['aliases'])) {
                 foreach ($globalOptions['aliases'] as $rel => $org) {
                     $result[] = array('id' => $seq, 'alias' => $rel, 'original' => $org);
                     $seq++;
                 }
             }
             break;
         case 'browser-compatibility':
             if (isset($globalOptions['browser-compatibility'])) {
                 foreach ($globalOptions['browser-compatibility'] as $rel) {
                     $result[] = array('id' => $seq, 'browserdef' => $rel);
                     $seq++;
                 }
             }
             break;
         case 'formatter':
             if (isset($globalOptions['formatter'])) {
                 foreach ($globalOptions['formatter'] as $rel) {
                     $result[] = array('id' => $seq, 'field' => getValueFromArray($rel, 'field'), 'converter-class' => getValueFromArray($rel, 'converter-class'), 'parameter' => getValueFromArray($rel, 'parameter'));
                     $seq++;
                 }
             }
             break;
         case 'dbsettings':
             $result[] = array('id' => $seq, 'db-class' => getValueFromArray($globalDBSpecs, 'db-class'), 'dsn' => getValueFromArray($globalDBSpecs, 'dsn'), 'option' => getValueFromArray($globalDBSpecs, 'option'), 'database' => getValueFromArray($globalDBSpecs, 'database'), 'user' => getValueFromArray($globalDBSpecs, 'user'), 'password' => getValueFromArray($globalDBSpecs, 'password'), 'server' => getValueFromArray($globalDBSpecs, 'server'), 'port' => getValueFromArray($globalDBSpecs, 'port'), 'protocol' => getValueFromArray($globalDBSpecs, 'protocol'), 'datatype' => getValueFromArray($globalDBSpecs, 'datatype'));
             $seq++;
             break;
         case 'external-db':
             if (isset($globalDBSpecs['external-db'])) {
                 foreach ($globalDBSpecs['external-db'] as $rel) {
                     $result[] = array('id' => $seq, 'db' => $rel);
                 }
             }
             break;
         case 'debug':
             $result[] = array('id' => 0, 'debug' => $globalDebug);
             $seq++;
             break;
     }
     $this->recordCount = $seq;
     return $result;
 }
示例#16
0
 /**
  * Retorna um valor que está na sessão e não é protegido
  * @param string $key
  * @param mixed $default
  * @return mixed
  */
 public function getData($key, $default = null)
 {
     if (in_array($key, $this->blocked)) {
         Factory::log()->debug('A chave "' . $key . '" é um valor protegido e não pode ser obtido diretamente');
         return $default;
     }
     return getValueFromArray($_SESSION, $key, $default);
 }
 /**
  * Returns model from JSON
  * @param $json
  * @return Action
  */
 public static function fromJSON($json)
 {
     return new Action(getValueFromArray($json, 'id'), getValueFromArray($json, 'name'), getValueFromArray($json, 'description'));
 }
示例#18
0
文件: cq-forms.php 项目: hcopr/Hubbub
 function display($opt = array())
 {
     if ($this->getDataOnDisplay) {
         $this->getData();
     }
     if ($this->hidden) {
         return;
     }
     if ($this->formClosed != true) {
         $this->params['formsubmit'] = $this->name;
         $this->add('end', $name, $name, array('params' => $this->params));
         $this->formClosed = true;
     }
     include_once $this->presentationDir . $this->presentationName . '.php';
     $templateInitFunction = $this->presentationName . '_init';
     if (is_callable($templateInitFunction)) {
         $templateInitFunction($this);
     }
     foreach ($this->elements as $e) {
         $sessionFieldName = $this->name . '-' . $e['name'];
         $e['pure-caption'] = $e['caption'];
         $e['caption'] .= $this->packCaption;
         if ($e['validate'] == 'notempty' && isset($this->mandatoryMarker)) {
             $e['caption'] = $e['caption'] . $this->mandatoryMarker;
         }
         if (trim($e['info']) != '') {
             $e['infomarker'] = str_replace('$', $e['info'], $this->infoMarker);
         }
         print $this->packStart;
         print getDefault($opt['field-start']);
         $dFunction = $this->presentationName . '_' . $e['type'];
         if ($e['sessiondefault'] == true) {
             $e['default'] = getDefault($_SESSION[$sessionFieldName], $e['default']);
         }
         $e['value'] = getDefault(getValueFromArray($this->ds, $e['name']), $e['default']);
         if ($e['sessiondefault'] == true) {
             $_SESSION[$sessionFieldName] = $e['value'];
         }
         $e['error'] = $this->errors[$e['name']];
         if (is_callable($dFunction)) {
             $dFunction($e, $this);
         } else {
             logError('form', 'CQForm: unknown form element type "' . $e['type'] . '"');
         }
         print getDefault($opt['field-end']);
         print $this->packEnd;
     }
     return $this;
 }
示例#19
0
 /**
  * Configura os dados para o modo render em tabela
  * 
  * @param array $dados
  * @param array $schema
  * @return string
  */
 public function getTable($dados, $schema)
 {
     $thead = array_keys($schema);
     $action = getValueFromArray($this->config, Crud::SHOW_TABLE_ACTIONS, true);
     if ($action) {
         $thead[] = 'Ações';
         #@todo refatorar init
         $dao_pks = $this->dao->getPKFieldName();
         if (is_string($dao_pks)) {
             $pk = $dao_pks;
         } else {
             if (is_array($dao_pks)) {
                 $pk = isset($dao_pks[0]) ? $dao_pks[0] : "no-primary-key-setted";
             } else {
                 $pk = "id";
                 //daoname_id
             }
         }
         $default_edit_url = str_replace('<id>', $pk, $this->urlbase . 'edit/{{<id>}}');
         $default_delete_url = str_replace('<id>', $pk, $this->urlbase . 'delete/{{<id>}}');
         $urledit = getValueFromArray($this->config, Crud::ACTION_URL_EDIT, $default_edit_url);
         $urldelete = getValueFromArray($this->config, Crud::ACTION_URL_DELETE, $default_delete_url);
         #refatorar end
     }
     $r = ['tfoot' => count($dados) . ' registro(s)', 'thead' => $thead, 'tbody' => [], 'class' => 'table-striped table-hover table-bordered browsetable'];
     $t = Template::singleton();
     foreach ($dados as $row) {
         $td = [];
         foreach ($schema as $template) {
             //date format would can be here :)
             $td[] = $t->renderHTML($template, $row);
         }
         if ($action) {
             $actions = HTML::link($t->renderHTML($urledit, $row), '<span class="glyphicon glyphicon-pencil"></span>', 'Editar este item', ['class' => 'btn btn-default btn-xs']);
             $actions .= ' ' . $this->getUserActions($t, $row);
             $showDelete = getValueFromArray($this->config, Crud::SHOW_DELETE_LINK, true);
             if ($showDelete) {
                 $actions .= ' ' . HTML::link($t->renderHTML($urldelete, $row), '<span class="glyphicon glyphicon-trash"></span>', 'Excluir este item', ['class' => 'btn btn-danger  btn-xs confirmacao']);
             }
             $td[] = $actions;
         }
         $r['tbody'][] = $td;
     }
     return $r;
 }
示例#20
0
 /**
  * Retorna o valor de um parâmetro já validado
  * @param string $name Nome do parâmetro
  * @param mixed $default Valor default que será retornado se $name for nulo
  * @return mixed Valor recebido ou o valor padrão
  */
 protected final function getParameter($name, $default = null)
 {
     return getValueFromArray($this->parametersValue, $name, $default);
 }
 /**
  * Returns model from JSON
  * @param $json
  * @return DocumentType
  */
 public static function fromJSON($json)
 {
     return new DocumentType(getValueFromArray($json, 'id'), getValueFromArray($json, 'name'));
 }
示例#22
0
 /**
  * Returns model from JSON
  * @param $json
  * @return Link
  */
 public static function fromJSON($json)
 {
     return new Link(getValueFromArray($json, 'id'), getValueFromArray($json, 'text'), getValueFromArray($json, 'description'), getValueFromArray($json, 'url'), getValueFromArray($json, 'linkCategoryId'), getValueFromArray($json, 'documentId'), getValueFromArray($json, 'documentTimestamp'), getValueFromArray($json, 'linkDocumentId'));
 }
示例#23
0
<?php

define('TEST_OR_INSTALL', true);
define("PATH_LOCAL", realpath(__DIR__));
//"D:\site\www\myframework\test"
define("PATH_MYFRAME", "C:\\www\\htdocs\\myframework-core");
define("PATH_APP", PATH_LOCAL . "/../app");
define("PATH_DEFAULT", PATH_LOCAL . '/../app_default');
define("SERVER_MODE", "DEVELOPMENT");
//require_once "D:/site/www/myframework/vendor/autoload.php";
require_once "/../vendor/autoload.php";
//funções utilitárias utilizadas nos testes
require_once "src/testfunctions.php";
require_once '/../src/mycore.php';
//classe base para os datatypes do framework
//require_once "src/DataType/DatatypeBaseTest.php";
$databaseconfig = getConfig(PATH_LOCAL . "/conf/database.local.ini");
define("DATABASE_DRIVER", getValueFromArray($databaseconfig['database'], 'driver'), '');
define("DATABASE_NAME", getValueFromArray($databaseconfig['database'], 'dbname', ''));
define("DATABASE_HOST", getValueFromArray($databaseconfig['database'], 'host', ''));
define("DATABASE_PORT", getValueFromArray($databaseconfig['database'], 'port', ''));
define("DATABASE_USER", getValueFromArray($databaseconfig['database'], 'user', ''));
define("DATABASE_PASSWORD", getValueFromArray($databaseconfig['database'], 'password'), '');
//Error lib - http://logging.apache.org/log4php/quickstart.html
Logger::configure(PATH_LOCAL . '/conf/php4log.xml');
示例#24
0
 /**
  * Retorna o valor de um atributo da página
  * @param type $name
  */
 public static function getAttribute($name, $default = null)
 {
     $attributes = self::get('_attributes', array());
     return getValueFromArray($attributes, $name, $default);
 }
 /**
  * Returns model from JSON
  * @param $json
  * @return TargetGroup
  */
 public static function fromJSON($json)
 {
     return new TargetGroup(getValueFromArray($json, 'id'), getValueFromArray($json, 'name'), getValueFromArray($json, 'description'), getValueFromArray($json, 'parentId'), getValueFromArray($json, 'abbreviation'));
 }
 /**
  * Returns model from JSON
  * @param $json
  * @return DocumentFieldValue
  */
 public static function fromJSON($json)
 {
     return new DocumentFieldValue(getValueFromArray($json, 'fieldId'), getValueFromArray($json, 'value'), getValueFromArray($json, 'documentId'), getValueFromArray($json, 'documentTimestamp'));
 }
 public static function fromJSON($json)
 {
     return new DocumentTargetGroup(getValueFromArray($json, 'targetGroupId'), getValueFromArray($json, 'deadline'), getValueFromArray($json, 'description'), getValueFromArray($json, 'actionId'), getValueFromArray($json, 'mandatoryId'), getValueFromArray($json, 'documentId'), getValueFromArray($json, 'documentTimestamp'));
 }
示例#28
0
 /**
  * Returns model from JSON
  * @param $json
  * @return Topic
  */
 public static function fromJSON($json)
 {
     return new Topic(getValueFromArray($json, 'id'), getValueFromArray($json, 'timestamp'), getValueFromArray($json, 'title'), getValueFromArray($json, 'description'), getValueFromArray($json, 'sequence'), getValueFromArray($json, 'parentId'), getValueFromArray($json, 'comment'), getValueFromArray($json, 'children'));
 }
 /**
  * Returns model from JSON
  * @param $json
  * @return DocumentField
  */
 public static function fromJSON($json)
 {
     return new DocumentField(getValueFromArray($json, 'id'), getValueFromArray($json, 'name'), getValueFromArray($json, 'description'), getValueFromArray($json, 'sequence'), getValueFromArray($json, 'mandatory'), getValueFromArray($json, 'documentTypeId'));
 }
示例#30
0
 public static function fromJSON($json)
 {
     return new User(getValueFromArray($json, 'id'), getValueFromArray($json, 'name'), getValueFromArray($json, 'email'), getValueFromArray($json, 'profileImage'), null, null);
 }