/** * Gets an instance of the Sahara_Database. * * @return Zend_Db instance * @throws Exception - 100 - Database not configured */ public static function getDatabase() { if (!Zend_Registry::isRegistered('db')) { if (!($dbconfig = Zend_Registry::get('config')->database)) { throw new Exception('Database not configured.', 100); } if (isset($dbconfig->failover) && $dbconfig->failover->enabled) { if (!($file = $dbconfig->failover->file)) { throw new Exception('Database fail over configuration file not configured.', 100); } /* If the database failover file does not exist, a fail over * operation is triggered to choose a database server to * connect to. */ if (!is_file($dbconfig->failover->file)) { if (!self::performFailover($dbconfig)) { throw new Exception('Failed database fail over, could not find an online server to use.', 100); } } else { if (!($dbconfig = new Zend_Config_Ini($dbconfig->failover->file))) { throw new Exception('Failed to load server from fail over configuration file.', 100); } self::_registerDatabase(Zend_Db::factory($dbconfig)); } } else { self::_registerDatabase(Zend_Db::factory($dbconfig)); } } return Zend_Registry::get('db'); }
/** * List of subscriptions */ public function indexAction() { $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table(); $this->view->subscriptionPlan = $subscriptionPlansTable->fetchAll(); //Get user $identity = Zend_Auth::getInstance()->getIdentity(); if ($identity) { $userId = $identity->id; //Get current subscription $subscriptionManager = new Subscriptions_Model_Subscription_Manager(); $currentSubscription = $subscriptionManager->getCurrentSubscription($userId); if ($currentSubscription) { $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table(); $currentSubscriptionPlan = $subscriptionPlansTable->getById($currentSubscription->subscriptionPlanId); $paypalHost = false; if (Zend_Registry::isRegistered('payments')) { $payments = Zend_Registry::get('payments'); if (isset($payments['gateways']) && $payments['gateways'] && isset($payments['gateways']['paypal']) && $payments['gateways']['paypal']) { $paypalHost = $payments['gateways']['paypal']['paypalHost']; } } if (!$paypalHost) { if (Zend_Registry::isRegistered('Log')) { $log = Zend_Registry::get('Log'); $log->log("PayPal is not configured.", Zend_Log::CRIT); } throw new Exception($this->__("Paypal is not configured.")); } $this->view->paypalHost = $paypalHost; $this->view->currentSubscription = $currentSubscription; $this->view->currentSubscriptionPlan = $currentSubscriptionPlan; } } }
public function clearRegistry() { if (Zend_Registry::isRegistered('Zend_Translate')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Translate']); } }
/** * Creates a new Base Model * * @param mixed|string,object $DbTableModel */ public function __construct($DbTableModel) { $this->setDbTable($DbTableModel); $page_size = Zend_Registry::isRegistered('default_page_size') ? Zend_Registry::get('default_page_size') : 20; $this->_defaultPageSize = $page_size; $this->_pageSize = $page_size; }
/** * Zend_Measure_Abstract is an abstract class for the different measurement types * * @param $value mixed - Value as string, integer, real or float * @param $type type - OPTIONAL a Zend_Measure_Area Type * @param $locale locale - OPTIONAL a Zend_Locale Type * @throws Zend_Measure_Exception */ public function __construct($value, $type = null, $locale = null) { if ($type !== null and Zend_Locale::isLocale($type, null, false)) { $locale = $type; $type = null; } if (empty($locale)) { require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale') === true) { $locale = Zend_Registry::get('Zend_Locale'); } } if ($locale === null) { $locale = new Zend_Locale(); } if (!Zend_Locale::isLocale($locale, true, false)) { if (!Zend_Locale::isLocale($locale, false, false)) { require_once 'Zend/Measure/Exception.php'; throw new Zend_Measure_Exception("Language (" . (string) $locale . ") is unknown"); } $locale = new Zend_Locale($locale); } $this->_locale = (string) $locale; if ($type === null) { $type = $this->_units['STANDARD']; } if (isset($this->_units[$type]) === false) { require_once 'Zend/Measure/Exception.php'; throw new Zend_Measure_Exception("Type ({$type}) is unknown"); } $this->setValue($value, $type, $this->_locale); }
/** * Returns the Zend_Acl object or null. * @return Zend_Acl */ protected function getAcl() { if (is_null($this->_acl)) { $this->_acl = Zend_Registry::isRegistered('Opus_Acl') ? Zend_Registry::get('Opus_Acl') : null; } return $this->_acl; }
public function checkRequire() { try { $subject = Engine_Api::_()->core()->getSubject(); } catch (Exception $e) { $subject = null; } $actionName = $this->getFrontController()->getRequest()->getActionName(); $ret = true; if (!$subject instanceof Core_Model_Item_Abstract || !$subject->getIdentity()) { $ret = false; } else { if (null !== $this->_requiredType && $subject->getType() != $this->_requiredType) { $ret = false; } else { if (null !== ($requireType = $this->getActionRequireType($actionName)) && $subject->getType() != $requireType) { $ret = false; } } } if (!$ret && APPLICATION_ENV == 'development' && Zend_Registry::isRegistered('Zend_Log') && ($log = Zend_Registry::get('Zend_Log')) instanceof Zend_Log) { $target = $this->getRequest()->getModuleName() . '.' . $this->getRequest()->getControllerName() . '.' . $this->getRequest()->getActionName(); $log->log('Require class ' . get_class($this) . ' failed check for: ' . $target, Zend_Log::DEBUG); } return $ret; }
/** * Create a jQuery UI Widget Date Picker * * @link http://docs.jquery.com/UI/Datepicker * @param string $id * @param string $value * @param array $params jQuery Widget Parameters * @param array $attribs HTML Element Attributes * @return string */ public function datePicker($id, $value = null, array $params = array(), array $attribs = array()) { $attribs = $this->_prepareAttributes($id, $value, $attribs); if (Zend_Registry::isRegistered('Zend_Locale')) { if (!isset($params['dateFormat'])) { $params['dateFormat'] = self::resolveZendLocaleToDatePickerFormat(); } $days = Zend_Locale::getTranslationList('Days'); if (!isset($params['dayNames'])) { $params['dayNames'] = array_values($days['format']['wide']); } if (!isset($params['dayNamesShort'])) { $params['dayNamesShort'] = array_values($days['format']['abbreviated']); } if (!isset($params['dayNamesMin'])) { $params['dayNamesMin'] = array_values($days['stand-alone']['narrow']); } $months = Zend_Locale::getTranslationList('Months'); if (!isset($params['monthNames'])) { $params['monthNames'] = array_values($months['stand-alone']['wide']); } if (!isset($params['monthNamesShort'])) { $params['monthNamesShort'] = array_values($months['stand-alone']['narrow']); } } // TODO: Allow translation of DatePicker Text Values to get this action from client to server $params = ZendX_JQuery::encodeJson($params); $js = sprintf('%s("#%s").datepicker(%s);', ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(), $attribs['id'], $params); $this->jquery->addOnLoad($js); return $this->view->formText($id, $value, $attribs); }
/** * Creates a currency instance. Every supressed parameter is used from the actual or the given locale. * * @param string $currency OPTIONAL currency short name * @param string|Zend_Locale $locale OPTIONAL locale name * @throws Zend_Currency_Exception When currency is invalid */ public function __construct($currency = null, $locale = null) { if (Zend_Locale::isLocale($currency, true, false)) { $temp = $locale; $locale = $currency; $currency = $temp; } if (empty($locale)) { require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale') === true) { $locale = Zend_Registry::get('Zend_Locale'); } } $this->setLocale($locale); // Get currency details $this->_options['currency'] = self::getShortName($currency, $this->_locale); $this->_options['name'] = self::getName($currency, $this->_locale); $this->_options['symbol'] = self::getSymbol($currency, $this->_locale); if ($this->_options['currency'] === null and $this->_options['name'] === null) { require_once 'Zend/Currency/Exception.php'; throw new Zend_Currency_Exception("Currency '{$currency}' not found"); } // Get the format $this->_options['position'] = $this->_updateFormat(); $this->_options['display'] = self::NO_SYMBOL; if (empty($this->_options['symbol']) === false) { $this->_options['display'] = self::USE_SYMBOL; } else { if (empty($this->_options['currency']) === false) { $this->_options['display'] = self::USE_SHORTNAME; } } }
/** * Wird beim Abholen der Clientnachrichten aufgerufen * @param integer $lastResponse * @param integer $actualResponse * @return RecordList */ public function getClientmessages($lastResponse, $actualResponse) { if (!Zend_Registry::isRegistered('DragonX_Storage_Engine')) { return new DragonX_Storage_RecordList(); } return Zend_Registry::get('DragonX_Storage_Engine')->loadBySqlStatement(new DragonX_Clientmessage_Record_All(), "SELECT * FROM `dragonx_clientmessage_record_all` " . "WHERE " . " `created` BETWEEN :lastResponse AND :actualResponse", array('lastResponse' => $lastResponse, 'actualResponse' => $actualResponse - 1)); }
public function __construct() { $emptyRegistry = array('css' => array('prepend' => array(), 'append' => array()), 'js' => array('prepend' => array(), 'append' => array())); if (!Zend_Registry::isRegistered(self::REGISTRY_KEY)) { Zend_Registry::set(self::REGISTRY_KEY, $emptyRegistry); } }
/** * Configures view class * */ protected function setupView() { if (Zend_Registry::isRegistered('config')) { $config = Zend_Registry::get('config'); $renderClass = $config->output->viewrenderer; $viewRenderer = new $renderClass(); $viewClass = $config->output->view->name; $viewRenderer->setView(new $viewClass($config->output->view->options->toArray())); } else { // Config file not detected, use defaults $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView(new Zoo_View_Php()); } $viewRenderer->setViewSuffix('phtml'); //make it search for .phtml files Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); //add it to the action helper broker // Set the encoding $viewRenderer->view->setEncoding("UTF-8"); $doctypeHelper = new Zend_View_Helper_Doctype(); $doctypeHelper->doctype('XHTML1_STRICT'); // Add core module's view helper path $viewRenderer->view->addHelperPath(ZfApplication::$_base_path . "/app/Zoo/views/helpers"); // Add JQuery support $viewRenderer->view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); }
public function __construct($type = null) { if (Zend_Registry::isRegistered('config')) { $_setting = Zend_Registry::get('config'); if ($_setting instanceof Zend_Config) { $_setting = $_setting->toArray(); } if (isset($_setting['log']['active'])) { $this->_isActive = $_setting['log']['active'] == 1; } if (isset($_setting['log']['type'])) { $this->_writerType = (string) $_setting['log']['type']; } if (self::LOG_STREAM == $this->_writerType && isset($_setting['log']['path'])) { $this->_logPath = (string) $_setting['log']['path']; if (!realpath($this->_logPath)) { mkdir($this->_logPath, 0755, TRUE); } } else { $this->_logPath = realpath(APPLICATION_PATH . "/../log"); } } if (isset($type) && !is_null($type) && is_string($type) && $this->__isAvalideType($type)) { $this->_writerType = $type; } }
static function isAllowed($resource, $module = "default", $username = null) { $users_roles_table = new UsersRoles(); $user_roles = array(); $roles_table = new Roles(); if (!is_null($username)) { $users_roles_db = $users_roles_table->fetchAll($users_roles_table->select()->where("username = ?", $username)); $user_roles = array(); if (count($users_roles_db) > 0) { foreach ($users_roles_db as $role) { $user_roles[] = $role->role_id; } } } else { $user_roles = array($roles_table->getIdByShortname("guest")); } $resource_name = $module . "-@@EXTRA-" . $resource; $out = false; if (Zend_Registry::isRegistered('acl')) { $acl = Zend_Registry::get('acl'); if ($acl->has($resource_name)) { foreach ($user_roles as $role) { if ($acl->isAllowed($role, $resource_name)) { $out = true; } } } } return $out; }
/** * Fetch the amount of comments for the items related to the $alias with keys * * @param mixed $key * @param string $alias * @param array $items * @param string $fieldName * @return integer * @throws Zend_Controller_Action_Exception */ public function commentsCounter($key, $alias, $items, $fieldName = 'id') { $aliasManager = new Comments_Model_CommentAlias_Manager(); $aliasRow = $aliasManager->getByAlias($alias); // check if alias registered if (!Zend_Registry::isRegistered($alias . '.' . $fieldName)) { $userId = $this->view->user() ? $this->view->user()->id : 0; $commentsManager = new Comments_Model_Comment_Manager(); $values = array(); // collect items foreach ($items as $item) { $value = (int) $item[$fieldName]; if ($value > 0) { array_push($values, $value); } } // fetch gropped comments amount $commentsAmount = $commentsManager->getGrouppedCommentsAmount($aliasRow, $fieldName, $values, $userId); Zend_Registry::set($alias . '.' . $fieldName, $commentsAmount); } // fetch the data from registry $commentsAmount = Zend_Registry::get($alias . '.' . $fieldName); if (isset($commentsAmount[$key])) { return $commentsAmount[$key]; } else { return 0; } }
public function getLog() { if (Zend_Registry::isRegistered('logger')) { $log = Zend_Registry::get('logger'); return $log; } }
private function storeLanguage() { if ($this->mySessionSite->Locale) { \Zend_Registry::set("Zend_Locale", $this->mySessionSite->Locale); } if ($this->_getParam("lg")) { $locale = new \Zend_Locale($this->_getParam("lg")); \Zend_Registry::set("Zend_Locale", $locale); } if (\Zend_Registry::isRegistered("Zend_Locale") and $this->mySessionSite->Locale) { //init forcée à french à reprendre $locale = \Zend_Registry::get("Zend_Locale"); } else { $locale = new \Zend_Locale("fr_FR"); \Zend_Registry::set("Zend_Locale", $locale); } $this->mySessionSite->Locale = $locale; $this->view->language = $this->language = $locale->getLanguage(); $languages = \Pimcore\Tool::getValidLanguages(); $languageOptions = array(); foreach ($languages as $short) { if (!empty($short)) { $languageOptions[] = array("language" => $short, "display" => \Zend_Locale::getTranslation($short == "fr_FR" ? "fr" : $short, 'Language', $locale)); $validLanguages[] = $short; } } $this->view->languageOptions = $languageOptions; $this->view->isAjax = $this->isAjax(); }
/** * Adds basic route startup things such as reading module list, adding errorhandler, setting up routes and adding translations * * @param Zend_Controller_Request_Abstract $request */ public function routeStartup(Zend_Controller_Request_Abstract $request) { if (Zend_Registry::isRegistered('config')) { $frontController =& Zend_Controller_Front::getInstance(); // Read installed modules list from modules.ini $moduleconfig = new Zend_Config_Ini(ZfApplication::$_data_path . '/etc/modules.ini', ZfApplication::$_environment); foreach ($moduleconfig->modules as $module => $folder) { $frontController->addControllerDirectory(ZfApplication::$_base_path . "{$folder}", $module); } // Set error handler $config =& Zend_Registry::get("config"); if ($config->plugin->errorhandler->class) { // Front controller will add this plugin automatically - but we may override the class in config if ($config->plugin->errorhandler->class != "Zend_Controller_Plugin_ErrorHandler") { $frontController->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler"); $errorHandlerClass = $config->plugin->errorhandler->class; $frontController->registerPlugin(new $errorHandlerClass(), 100); } } // Add routes if (file_exists(ZfApplication::$_data_path . '/etc/routes.ini')) { // Retrieve the router from the frontcontroller $router = $frontController->getRouter(); // Add routes from config file $routerconfig = new Zend_Config_Ini(ZfApplication::$_data_path . '/etc/routes.ini'); $router->addConfig($routerconfig); } // Add services if (file_exists(ZfApplication::$_data_path . '/etc/services.ini')) { Zoo::initServices(new Zend_Config_Ini(ZfApplication::$_data_path . '/etc/services.ini')); } } }
/** * Getter for ACL object. * * @return Core_Model_Acl_Core ACL object */ public function getAcl() { if (false === Zend_Registry::isRegistered('acl')) { $this->setAcl(new Core_Model_Acl_Core()); } return Zend_Registry::get('acl'); }
public function init() { if (!Zend_Registry::isRegistered('extConfig')) { $configTable = new Application_Model_DbTable_Config(); Zend_Registry::set('extConfig', $configTable->selectConfig()); } }
/** * Constructor for the integer validator * * Accepts either a string locale, a Zend_Locale object, or an array or * Zend_Config object containing the keys "locale" and/or "format". * * @param string|Zend_Locale|array|Zend_Config $options * @throws Zend_Validate_Exception On empty format */ public function __construct($options = null) { if ($options instanceof Zend_Config) { $options = $options->toArray(); } if (empty($options)) { #require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $this->setLocale(Zend_Registry::get('Zend_Locale')); } } elseif (is_array($options)) { // Received if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } if (array_key_exists('format', $options)) { $this->setFormat($options['format']); } } elseif ($options instanceof Zend_Locale || is_string($options)) { // Received Locale object or string locale $this->setLocale($options); } $format = $this->getFormat(); if (empty($format)) { #require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("A postcode-format string has to be given for validation"); } }
/** * __construct() - For concrete implementation of Zend_Db_Table * * @param string|array $config string can reference a Zend_Registry key for a db adapter * OR it can reference the name of a table * @param array|Zend_Db_Table_Definition $definition */ public function __construct($config = array(), $definition = null) { if ($definition !== null && is_array($definition)) { $definition = new Zend_Db_Table_Definition($definition); } if (is_string($config)) { if (Zend_Registry::isRegistered($config)) { trigger_error(__CLASS__ . '::' . __METHOD__ . '(\'registryName\') is not valid usage of Zend_Db_Table, ' . 'try extending Zend_Db_Table_Abstract in your extending classes.', E_USER_NOTICE ); $config = array(self::ADAPTER => $config); } else { // process this as table with or without a definition if ($definition instanceof Zend_Db_Table_Definition && $definition->hasTableConfig($config)) { // this will have DEFINITION_CONFIG_NAME & DEFINITION $config = $definition->getTableConfig($config); } else { $config = array(self::NAME => $config); } } } parent::__construct($config); }
/** * Retrieve translate object * * @return Zend_Translate * @throws Zend_Application_Resource_Exception if registry key was used * already but is no instance of Zend_Translate */ public function getTranslate() { if (null === $this->_translate) { $options = $this->getOptions(); if (!isset($options['data'])) { // require_once 'Zend/Application/Resource/Exception.php'; throw new Zend_Application_Resource_Exception('No translation source data provided.'); } $adapter = isset($options['adapter']) ? $options['adapter'] : Zend_Translate::AN_ARRAY; $locale = isset($options['locale']) ? $options['locale'] : null; $translateOptions = isset($options['options']) ? $options['options'] : array(); $key = isset($options['registry_key']) && !is_numeric($options['registry_key']) ? $options['registry_key'] : self::DEFAULT_REGISTRY_KEY; if (Zend_Registry::isRegistered($key)) { $translate = Zend_Registry::get($key); if (!$translate instanceof Zend_Translate) { // require_once 'Zend/Application/Resource/Exception.php'; throw new Zend_Application_Resource_Exception($key . ' already registered in registry but is ' . 'no instance of Zend_Translate'); } $translate->addTranslation($options['data'], $locale, $options); $this->_translate = $translate; } else { $this->_translate = new Zend_Translate($adapter, $options['data'], $locale, $translateOptions); Zend_Registry::set($key, $this->_translate); } } return $this->_translate; }
/** * Get cache tags for the block's content * @return array */ function getCacheTags() { if (Zend_Registry::isRegistered('content_id')) { return array('node_' . Zend_Registry::get('content_id')); } return parent::getCacheTags(); }
/** * Sets validator options * * @param string|array|Zend_Config $options OPTIONAL */ public function __construct($options = array()) { if ($options instanceof Zend_Config) { $options = $options->toArray(); } else { if (!is_array($options)) { $options = func_get_args(); $temp['format'] = array_shift($options); if (!empty($options)) { $temp['locale'] = array_shift($options); } $options = $temp; } } if (array_key_exists('format', $options)) { $this->setFormat($options['format']); } if (!array_key_exists('locale', $options)) { if (Zend_Registry::isRegistered('Zend_Locale')) { $options['locale'] = Zend_Registry::get('Zend_Locale'); } } if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } }
/** * Translate a message * You can give multiple params or an array of params. * If you want to output another locale just set it as last single parameter * Example 1: translate('%1\$s + %2\$s', $value1, $value2, $locale); * Example 2: translate('%1\$s + %2\$s', array($value1, $value2), $locale); * * @param string $messageid * @return string Translated message */ public function translate($messageid = null) { if ($this->translate === null) { require_once 'Zend/Registry.php'; if (!Zend_Registry::isRegistered('Zend_Translate')) { if (empty($messageid)) { return $this; } else { return $messageid; } } else { $this->translate = Zend_Registry::get('Zend_Translate'); } } $options = func_get_args(); array_shift($options); $count = count($options); $locale = null; if ($count > 0) { if (Zend_Locale::isLocale($options[$count - 1])) { $locale = array_pop($options); } } if (count($options) == 1 and is_array($options[0])) { $options = $options[0]; } $message = $this->translate->translate($messageid, $locale); return vsprintf($message, $options); }
public function init() { $categories = Axis::single('catalog/category')->select('*')->addName(Axis_Locale::getLanguageId())->addKeyWord()->order('cc.lft')->addSiteFilter(Axis::getSiteId())->addDisabledFilter()->fetchAll(); if (!is_array($this->_activeCategories)) { $this->_activeCategories = array(); if (Zend_Registry::isRegistered('catalog/current_category')) { $this->_activeCategories = array_keys(Zend_Registry::get('catalog/current_category')->cache()->getParentItems()); } } $container = $_container = new Zend_Navigation(); $lvl = 0; $view = $this->getView(); foreach ($categories as $_category) { $uri = $view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'controller' => 'catalog', 'action' => 'view'), false, true); $class = 'nav-' . str_replace('.', '-', $_category['key_word']); $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'class' => $class, 'visible' => 'enabled' === $_category['status'] ? true : false, 'active' => in_array($_category['id'], $this->_activeCategories))); $lvl = $lvl - $_category['lvl'] + 1; for ($i = 0; $i < $lvl; $i++) { $_container = $_container->getParent(); } $lvl = $_category['lvl']; $_container->addPage($page); $_container = $page; } $this->setData('menu', $container); return true; }
/** * POST request from PayPal * * @throws Zend_Controller_Action_Exception */ public function callbackAction() { //check request if ($this->getRequest()->isPost()) { $txnId = $this->getRequest()->getParam('txn_id'); $txnType = $this->getRequest()->getParam('txn_type'); if ($txnId || $txnType && $txnType === 'subscr_cancel') { $params = $this->getRequest()->getParams(); $orderManager = new Payments_Model_Order_Manager(); try { $orderManager->handlePaypalRequest($params); if (Zend_Registry::isRegistered('Log')) { $log = Zend_Registry::get('Log'); $log->log('Payment with params ' . var_export($params, true) . ' is successful.', Zend_Log::INFO); } return; //ok } catch (Exception $e) { if (Zend_Registry::isRegistered('Log')) { $log = Zend_Registry::get('Log'); $log->log($e->getMessage() . ' at ' . $e->getFile() . '#' . $e->getLine(), Zend_Log::CRIT); } } } } else { if (Zend_Registry::isRegistered('Log')) { $log = Zend_Registry::get('Log'); $log->log('GET request to Payments_PaypalController->callbackAction()', Zend_Log::WARN); } } throw new Zend_Controller_Action_Exception('Page not found'); }
/** * Create a jQuery UI Widget Date Picker * * @link http://docs.jquery.com/UI/Datepicker * @param string $id * @param string $value * @param array $params jQuery Widget Parameters * @param array $attribs HTML Element Attributes * @return string */ public function datePicker($id, $value = null, array $params = array(), array $attribs = array()) { $attribs = $this->_prepareAttributes($id, $value, $attribs); // // Prepare params // if (!isset($params['dateFormat']) && Zend_Registry::isRegistered('Zend_Locale')) { $params['dateFormat'] = $this->_resolveLocaleToDatePickerFormat(); } // TODO: Allow translation of DatePicker Text Values to get this action from client to server if (count($params) > 0) { /** * @see Zend_Json */ require_once "Zend/Json.php"; $params = Zend_Json::encode($params); } else { $params = "{}"; } $js = sprintf('%s("#%s").datepicker(%s);', ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(), $attribs['id'], $params); // // Add DatePicker callup to onLoad Stack // $this->jquery->addOnLoad($js); return $this->view->formText($id, $value, $attribs); }
/** * Constructor * * @param Zym_Acl $acl */ public function __construct(Zym_Acl $acl = null) { $this->_acl = $acl; if (!Zend_Registry::isRegistered(Zym_Acl::REGISTRY_KEY)) { Zend_Registry::set(Zym_Acl::REGISTRY_KEY, $acl); } }