当前位置: 首页>>代码示例>>PHP>>正文


PHP Tools::atktext方法代码示例

本文整理汇总了PHP中Sintattica\Atk\Core\Tools::atktext方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::atktext方法的具体用法?PHP Tools::atktext怎么用?PHP Tools::atktext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sintattica\Atk\Core\Tools的用法示例。


在下文中一共展示了Tools::atktext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_atkdatefield

/**
 * Function for embedding a date control in html.
 *
 * @author Peter C. Verhage <peter@ibuildings.nl>
 */
function smarty_function_atkdatefield($params, $smarty)
{
    $name = isset($params['name']) ? $params['name'] : 'date';
    $format = isset($params['format']) ? $params['format'] : Tools::atktext('date_format_edit', 'atk', '', '', '', true);
    $mandatory = isset($params['mandatory']) && $params['mandatory'] || isset($params['obligatory']) && $params['obligatory'];
    $noweekday = isset($params['noweekday']) && $params['noweekday'];
    $calendar = isset($params['calendar']) && $params['calendar'];
    $time = isset($params['time']) ? $params['time'] : ($mandatory ? mktime() : null);
    $min = isset($params['min']) ? $params['min'] : 0;
    $max = isset($params['max']) ? $params['max'] : 0;
    if (is_array($time)) {
        $date = $time;
    } else {
        if ($time == null) {
            $date = null;
        } else {
            if (is_numeric($time)) {
                $date = getdate($time);
                $date = array('day' => $date['mday'], 'month' => $date['mon'], 'year' => $date['year']);
            } else {
                if (preg_match('/([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})/', $time, $matches)) {
                    $date = array('day' => (int) $matches[1], 'month' => (int) $matches[2], 'year' => $matches[3]);
                } else {
                    $date = getdate(strtotime($time));
                    $date = array('day' => $date['mday'], 'month' => $date['mon'], 'year' => $date['year']);
                }
            }
        }
    }
    $attr = new DateAttribute($name, $format, '', $min, $max, ($noweekday ? DateAttribute::AF_DATE_EDIT_NO_DAY : 0) | ($mandatory ? Attribute::AF_OBLIGATORY : 0) | ($calendar ? 0 : DateAttribute::AF_DATE_NO_CALENDAR));
    $html = $attr->edit(array($name => $date), '', '');
    return $html;
}
开发者ID:sintattica,项目名称:atk,代码行数:38,代码来源:function.atkdatefield.php

示例2: smarty_function_atktext

/**
 * function to get multilanguage strings.
 *
 * This is actually a wrapper for ATK's Tools::atktext() method, for
 * use in templates.
 *
 * @author Ivo Jansch <ivo@achievo.org>
 *
 * Example: {atktext id="users.userinfo.description"}
 *          {atktext id="userinfo.description" module="users"}
 *          {atktext id="description" module="users" node="userinfo"}
 */
function smarty_function_atktext($params, $smarty)
{
    if (!isset($params['id'])) {
        $params['id'] = $params[0];
    }
    switch (substr_count($params['id'], '.')) {
        case 1:
            list($module, $id) = explode('.', $params['id']);
            $str = Tools::atktext($id, $module, isset($params['node']) ? $params['node'] : '');
            break;
        case 2:
            list($module, $node, $id) = explode('.', $params['id']);
            $str = Tools::atktext($id, $module, $node);
            break;
        default:
            $str = Tools::atktext($params['id'], Tools::atkArrayNvl($params, 'module', ''), Tools::atkArrayNvl($params, 'node', ''), Tools::atkArrayNvl($params, 'lng', ''));
    }
    if (isset($params['filter'])) {
        $fn = $params['filter'];
        $str = $fn($str);
    }
    // parse the rest of the params in the string
    $parser = new StringParser($str);
    return $parser->parse($params);
}
开发者ID:sintattica,项目名称:atk,代码行数:37,代码来源:function.atktext.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for the attribute
  * @param array $options CKEditor configuration options
  */
 public function __construct($name, $flags = 0, $options = [])
 {
     $this->ckOptions['language'] = Language::getLanguage();
     $this->ckOptions['wsc_lang'] = $this->ckOptions['scayt_sLang'] = Tools::atktext('locale');
     $this->ckOptions = array_merge($this->ckOptions, Config::getGlobal('ck_options'), $options);
     parent::__construct($name, $flags);
 }
开发者ID:sintattica,项目名称:atk,代码行数:14,代码来源:CkAttribute.php

示例4: getMenuTranslation

 /**
  * Translates a menuitem with the menu_ prefix, or if not found without.
  *
  * @param string $menuitem Menuitem to translate
  * @param string $modname Module to which the menuitem belongs
  *
  * @return string Translation of the given menuitem
  */
 public function getMenuTranslation($menuitem, $modname = 'atk')
 {
     $s = Tools::atktext("menu_{$menuitem}", $modname, '', '', '', true);
     if (!$s) {
         $s = Tools::atktext($menuitem, $modname);
     }
     return $s;
 }
开发者ID:sintattica,项目名称:atk,代码行数:16,代码来源:Menu.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param string $currencysymbol The symbol which is printed in front of the value.
  * @param int $decimals The number of decimals (default 2)
  * @param string $decimalseparator The separator which is printed for the decimals.
  * @param string $thousandsseparator The separator which is printed for the thousands.
  */
 public function __construct($name, $flags = 0, $currencysymbol = '', $decimals = 2, $decimalseparator = '', $thousandsseparator = '')
 {
     parent::__construct($name, $flags, $decimals);
     $this->setAttribSize(10);
     if ($currencysymbol == '') {
         $currencysymbol = Tools::atktext('currencysymbol', 'atk', '', '', '', true);
     }
     $this->m_currencysymbol = $currencysymbol;
     $this->m_decimalseparator = $decimalseparator != '' ? $decimalseparator : '.';
     $this->m_thousandsseparator = $thousandsseparator != '' ? $thousandsseparator : ',';
     $this->setUseThousandsSeparator(true);
 }
开发者ID:sintattica,项目名称:atk,代码行数:22,代码来源:CurrencyAttribute.php

示例6: handle

 /**
  * Handle the error.
  *
  * @param string $errorMessage
  * @param string $debugMessage
  */
 public function handle($errorMessage, $debugMessage)
 {
     if ($this->zendPlatformAvailable()) {
         // log in zend platform
         $errMsg = implode(' | ', is_array($errorMessage) ? $errorMessage : array());
         if ($errMsg == '') {
             $errMsg = 'Something went terribly wrong, but there is no errormessage set...';
         } else {
             $errMsg = preg_replace('/\\[\\+.*s\\]/', '', $errMsg);
         }
         // get rid of timestamps because they will prevent ZP from finding duplicate errors
         monitor_custom_event(Tools::atktext('app_title'), $errMsg, true);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:20,代码来源:ZendPlatformErrorHandler.php

示例7: search

 public function search($record, $extended = false, $fieldprefix = '', DataGrid $grid = null)
 {
     $this->createDestination();
     if ($this->m_destinationFilter != '') {
         $sp = new StringParser($this->m_destinationFilter);
         $this->m_destInstance->addFilter($sp->parse($record));
     }
     $recordset = $this->m_destInstance->select()->includes(Tools::atk_array_merge($this->m_destInstance->descriptorFields(), $this->m_destInstance->m_primaryKey))->getAllRows();
     $result = '<select class="form-control" name="atksearch[' . $this->fieldName() . ']">';
     $result .= '<option value="">' . Tools::atktext('search_all', 'atk');
     $result .= $this->createdd($recordset);
     $result .= '</select>';
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:14,代码来源:ManyToOneTreeRelation.php

示例8: validate

 /**
  * Validates email address through regular expression and dns check.
  *
  * @param array $record Record that contains value to be validated.
  *                       Errors are saved in this record, in the 'atkerror'
  *                       field.
  * @param string $mode Validation mode. Can be either "add" or "update"
  */
 public function validate(&$record, $mode)
 {
     $email = $record[$this->fieldName()];
     //first check complete string
     if (!self::validateAddressSyntax($email)) {
         Tools::triggerError($record, $this, 'error_invalid_email');
     } else {
         if ($this->m_dnsSearch) {
             //now check if domain exists, searches DNS for MX records
             list(, $domain) = explode('@', $email, 2);
             if (!self::validateAddressDomain($domain, false)) {
                 Tools::triggerError($record, $this->fieldName(), 'error_unkown_domain', Tools::atktext('error_unkown_domain') . ' ' . $domain);
             }
         }
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:24,代码来源:EmailAttribute.php

示例9: __construct

 public function __construct($environment, $basedir)
 {
     global $g_startTime;
     $g_startTime = microtime(true);
     if (static::$s_instance) {
         throw new \RuntimeException('Only one Atk app can be created');
     }
     static::$s_instance = $this;
     $this->environment = $environment;
     //load .env variables only in development environment
     if (file_exists($basedir . '.env') && in_array(strtolower($environment), ['dev', 'develop', 'development'])) {
         $dotEnv = new Dotenv($basedir);
         $dotEnv->load();
     }
     require_once 'adodb-time.php';
     Config::init();
     if (Config::getGlobal('debug') > 0) {
         ini_set('display_errors', 1);
     }
     if (Config::getGlobal('use_atkerrorhandler', true)) {
         set_error_handler('Sintattica\\Atk\\Core\\Tools::atkErrorHandler');
         error_reporting(E_ALL);
         set_exception_handler('Sintattica\\Atk\\Core\\Tools::atkExceptionHandler');
         register_shutdown_function('Sintattica\\Atk\\Core\\Tools::atkFatalHandler');
     }
     // Filter the atkselector REQUEST variable for blacklisted SQL (like UNIONs)
     SqlWhereclauseBlacklistChecker::filter_request_where_clause('atkselector');
     SqlWhereclauseBlacklistChecker::filter_request_where_clause('atkfilter');
     // set locale
     $locale = Tools::atktext('locale', 'atk', '', '', true);
     if ($locale) {
         setlocale(LC_TIME, $locale);
     }
     $debug = 'Created a new Atk (' . self::VERSION . ') instance.';
     $debug .= ' Environment: ' . $environment . '.';
     if (isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_ADDR'])) {
         $debug .= ' Server info: ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ')';
     }
     Tools::atkdebug($debug);
     //load modules
     $modules = Config::getGlobal('modules');
     if (is_array($modules)) {
         foreach ($modules as $module) {
             static::$s_instance->registerModule($module);
         }
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:47,代码来源:Atk.php

示例10: feedbackPage

 /**
  * The method returns a complete html page containing the feedback info.
  *
  * @param string $action The action for which feedback is provided
  * @param int $actionstatus The status of the action for which feedback is
  *                             provided
  * @param string $message An optional message to display in addition to the
  *                             default feedback information message.
  *
  * @return string The feedback page as an html String.
  */
 public function feedbackPage($action, $actionstatus, $message = '')
 {
     $node = $this->m_node;
     $ui = $this->getUi();
     $params['content'] = '<br>' . Tools::atktext('feedback_' . $action . '_' . Tools::atkActionStatus($actionstatus), $node->m_module, $node->m_type);
     if ($message) {
         $params['content'] .= ' <br>' . $message;
     }
     $sm = SessionManager::getInstance();
     if ($sm->atkLevel() > 0) {
         $params['formstart'] = '<form method="get">' . $sm->formState(SessionManager::SESSION_BACK);
         $params['buttons'][] = '<input type="submit" class="btn btn-default btn_cancel" value="&lt;&lt; ' . Tools::atktext('back') . '">';
         $params['formend'] = '</form>';
     }
     $output = $ui->renderAction($action, $params);
     return $ui->renderBox(array('title' => $node->actionTitle($action), 'content' => $output));
 }
开发者ID:sintattica,项目名称:atk,代码行数:28,代码来源:FeedbackHandler.php

示例11: validateUser

 /**
  * Authenticate a user.
  *
  * @param string $user The login of the user to authenticate.
  * @param string $passwd The password of the user. Note: if the canMd5
  *                       function of an implementation returns true,
  *                       $passwd will be passed as an md5 string.
  *
  * @return int SecurityManager::AUTH_SUCCESS - Authentication succesful
  *             SecurityManager::AUTH_MISMATCH - Authentication failed, wrong
  *             user/password combination
  *             SecurityManager::AUTH_LOCKED - Account is locked, can not login
  *             with current username.
  *             SecurityManager::AUTH_ERROR - Authentication failed due to some
  *             error which cannot be solved by
  *             just trying again. If you return
  *             this value, you *must* also
  *             fill the m_fatalError variable.
  */
 public function validateUser($user, $passwd)
 {
     if ($user == '') {
         return SecurityManager::AUTH_UNVERIFIED;
     }
     // can't verify if we have no userid
     // if it's a virtual mail server add @<domain> to the username
     if (Config::getGlobal('auth_mail_login_type') == 'vmailmgr') {
         $user = $user . '@' . Config::getGlobal('auth_mail_suffix');
     }
     if (Config::getGlobal('auth_mail_server') == '') {
         $this->m_fatalError = Tools::atktext('auth_no_server');
         return SecurityManager::AUTH_ERROR;
     }
     $mailauth = @imap_open('{' . Config::getGlobal('auth_mail_server') . ':' . Config::getGlobal('auth_mail_port') . '}', $user, $passwd);
     // TODO/FIXME: return SecurityManager::AUTH_ERROR when connection fails..
     if ($mailauth == 0) {
         return SecurityManager::AUTH_MISMATCH;
     } else {
         imap_close($mailauth);
         return SecurityManager::AUTH_SUCCESS;
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:42,代码来源:ImapAuth.php

示例12: search

 /**
  * Returns a piece of html code that can be used in a form to search for values.
  *
  * @param array $record Array with values
  * @param bool $extended if set to false, a simple search input is
  *                            returned for use in the searchbar of the
  *                            recordlist. If set to true, a more extended
  *                            search may be returned for the 'extended'
  *                            search page. The Attribute does not
  *                            make a difference for $extended is true, but
  *                            derived attributes may reimplement this.
  * @param string $fieldprefix The fieldprefix of this attribute's HTML element.
  * @param DataGrid $grid
  *
  * @return string piece of html code with a checkbox
  */
 public function search($record, $extended = false, $fieldprefix = '', DataGrid $grid = null)
 {
     $id = $this->getHtmlId($fieldprefix);
     $name = $this->getSearchFieldName($fieldprefix);
     $result = '<select id="' . $id . '" name="' . $name . '" class="form-control select-standard">';
     $result .= '<option value="">' . Tools::atktext('search_all', 'atk') . '</option>';
     $result .= '<option value="0" ';
     if (is_array($record) && $record[$this->fieldName()] === '0') {
         $result .= 'selected';
     }
     $result .= '>' . Tools::atktext('no', 'atk') . '</option>';
     $result .= '<option value="1" ';
     if (is_array($record) && $record[$this->fieldName()] === '1') {
         $result .= 'selected';
     }
     $result .= '>' . Tools::atktext('yes', 'atk') . '</option>';
     $result .= '</select>';
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:35,代码来源:BoolAttribute.php

示例13: getAddLabel

 /**
  * Attempts to get a translated label which can be used when composing an "add" link.
  *
  * @return string Localised "add" label
  */
 public function getAddLabel()
 {
     $key = 'link_' . $this->fieldName() . '_add';
     $label = Tools::atktext($key, $this->m_ownerInstance->m_module, $this->m_ownerInstance->m_type, '', '', true);
     if ($label == '') {
         $label = Tools::atktext($key, $this->m_destInstance->m_module, '', '', '', true);
         if ($label == '') {
             $key = 'link_' . Tools::getNodeType($this->m_destination) . '_add';
             $label = Tools::atktext($key, $this->m_destInstance->m_module, '', '', '', true);
             if ($label == '') {
                 $label = Tools::atktext('link_add', 'atk');
             }
         }
     }
     return $label;
 }
开发者ID:sintattica,项目名称:atk,代码行数:21,代码来源:Relation.php

示例14: editForm

 /**
  * Function returns a generic html form for editing a record.
  *
  * @param string $mode The edit mode ("add" or "edit").
  * @param array $record The record to edit.
  * @param array $forceList A key-value array used to preset certain
  *                             fields to a certain value.
  * @param array $suppressList An array of fields that will be hidden.
  * @param string $fieldprefix If set, each form element is prefixed with
  *                             the specified prefix (used in embedded
  *                             forms)
  * @param string $template The template to use for the edit form
  * @param bool $ignoreTab Ignore the tabs an attribute should be shown on.
  *
  * @return string the edit form as a string
  */
 public function editForm($mode = 'add', $record = null, $forceList = '', $suppressList = '', $fieldprefix = '', $template = '', $ignoreTab = false)
 {
     $node = $this->m_node;
     /* get data, transform into form, return */
     $data = $node->editArray($mode, $record, $forceList, $suppressList, $fieldprefix, $ignoreTab);
     // Format some things for use in tpl.
     /* check for errors and display them */
     $tab = $node->getActiveTab();
     $error_title = '';
     $pk_err_attrib = [];
     $tabs = $node->getTabs($node->m_action);
     // Handle errors
     $errors = [];
     if (count($data['error']) > 0) {
         $error_title = '<b>' . Tools::atktext('error_formdataerror') . '</b>';
         foreach ($data['error'] as $error) {
             if ($error['err'] == 'error_primarykey_exists') {
                 $pk_err_attrib[] = $error['attrib_name'];
             } else {
                 if (count($tabs) > 1 && $error['tab']) {
                     $tabLink = $this->getTabLink($node, $error);
                     $error_tab = ' (' . Tools::atktext('error_tab') . ' ' . $tabLink . ' )';
                 } else {
                     $tabLink = null;
                     $error_tab = '';
                 }
                 if (is_array($error['label'])) {
                     $label = implode(', ', $error['label']);
                 } else {
                     if (!empty($error['label'])) {
                         $label = $error['label'];
                     } else {
                         if (!is_array($error['attrib_name'])) {
                             $label = $node->text($error['attrib_name']);
                         } else {
                             $label = [];
                             foreach ($error['attrib_name'] as $attrib) {
                                 $label[] = $node->text($attrib);
                             }
                             $label = implode(', ', $label);
                         }
                     }
                 }
                 /* Error messages should be rendered in templates using message, label and the link to the tab. */
                 $err = array('message' => $error['msg'], 'tablink' => $tabLink, 'label' => $label);
                 /*
                  * @deprecated: For backwards compatibility, we still support the msg variable as well.
                  * Although the message, tablink variables should be used instead of msg and tab.
                  */
                 $err = array_merge($err, array('msg' => $error['msg'] . $error_tab));
                 $errors[] = $err;
             }
         }
         if (count($pk_err_attrib) > 0) {
             // Make primary key error message
             $pk_err_msg = '';
             for ($i = 0; $i < count($pk_err_attrib); ++$i) {
                 $pk_err_msg .= Tools::atktext($pk_err_attrib[$i], $node->m_module, $node->m_type);
                 if ($i + 1 < count($pk_err_attrib)) {
                     $pk_err_msg .= ', ';
                 }
             }
             $errors[] = array('label' => Tools::atktext('error_primarykey_exists'), 'message' => $pk_err_msg);
         }
     }
     /* display the edit fields */
     $fields = [];
     $errorFields = [];
     $attributes = [];
     for ($i = 0, $_i = count($data['fields']); $i < $_i; ++$i) {
         $field =& $data['fields'][$i];
         $tplfield = $this->createTplField($data['fields'], $i, $mode, $tab);
         $fields[] = $tplfield;
         // make field available in numeric array
         $params[isset($field['name']) ? $field['name'] : null] = $tplfield;
         // make field available in associative array
         $attributes[isset($field['name']) ? $field['name'] : null] = $tplfield;
         // make field available in associative array
         if (!empty($field['error'])) {
             $errorFields[] = $field['id'];
         }
     }
     $ui = $this->getUi();
     $page = $this->getPage();
//.........这里部分代码省略.........
开发者ID:sintattica,项目名称:atk,代码行数:101,代码来源:EditHandler.php

示例15: addToViewArray

 /**
  * Adds the attribute's view / hide HTML code to the view array.
  *
  * This method is called by the node if it wants the data needed to create
  * a view form.
  *
  * This is a framework method, it should never be called directly.
  *
  * @param string $mode the mode ("view")
  * @param array $arr pointer to the view array
  * @param array $defaults pointer to the default values array
  */
 public function addToViewArray($mode, &$arr, &$defaults)
 {
     if ($this->hasFlag(self::AF_HIDE_VIEW)) {
         return;
     }
     /* we first check if there is no display override method, if there
      * is this method has the same behaviour as the Attribute's method
      */
     if (method_exists($this->m_ownerInstance, $this->m_name . '_display') || $this->display($defaults, 'view') !== null) {
         $this->addToViewArray($mode, $arr, $defaults);
     } else {
         if (!$this->createDestination()) {
             return;
         }
         $record = $defaults[$this->fieldName()];
         $a = $this->m_destInstance->viewArray($mode, $record, false);
         /* editable fields, if self::AF_NOLABEL is specified or if there is just 1 field with the
          * same name as the relation we don't display a label
          * TODO FIXME
          */
         if (!is_array($arr['fields'])) {
             $arr['fields'] = [];
         }
         if (!$this->hasFlag(self::AF_ONETOONE_INTEGRATE) && !$this->hasFlag(self::AF_NOLABEL) && !(count($a['fields']) == 1 && $a['fields'][0]['name'] == $this->m_name)) {
             /* separator and name */
             if ($arr['fields'][count($arr['fields']) - 1]['html'] !== '-') {
                 $arr['fields'][] = array('html' => '-', 'tabs' => $this->m_tabs, 'sections' => $this->getSections());
             }
             $arr['fields'][] = array('line' => '<b>' . Tools::atktext($this->m_name, $this->m_ownerInstance->m_module, $this->m_ownerInstance->m_type) . '</b>', 'tabs' => $this->m_tabs, 'sections' => $this->getSections());
         }
         if (is_array($a['fields'])) {
             if (!$this->hasFlag(self::AF_ONETOONE_INTEGRATE) || $this->hasFlag(self::AF_ONETOONE_RESPECT_TABS)) {
                 foreach (array_keys($a['fields']) as $key) {
                     $a['fields'][$key]['tabs'] = $this->m_tabs;
                     $a['fields'][$key]['sections'] = $this->getSections();
                 }
             }
             $arr['fields'] = array_merge($arr['fields'], $a['fields']);
         }
         if (!$this->hasFlag(self::AF_ONETOONE_INTEGRATE) && !$this->hasFlag(self::AF_NOLABEL) && !(count($a['fields']) == 1 && $a['fields'][0]['name'] == $this->m_name)) {
             /* separator */
             $arr['fields'][] = array('html' => '-', 'tabs' => $this->m_tabs, 'sections' => $this->getSections());
         }
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:57,代码来源:OneToOneRelation.php


注:本文中的Sintattica\Atk\Core\Tools::atktext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。