本文整理汇总了PHP中Zend_Filter_Alnum类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter_Alnum类的具体用法?PHP Zend_Filter_Alnum怎么用?PHP Zend_Filter_Alnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Filter_Alnum类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getObject
public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
{
$object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
$cPlatformXml = $this->getValue('cplatform_xml');
$doc = new DOMDocument();
$doc->loadXML($cPlatformXml);
$itemsNode = $doc->getElementsByTagName('items')->item(0);
$cPlatformArray = array();
if ($itemsNode) {
$itemNodes = $itemsNode->getElementsByTagName('item');
foreach ($itemNodes as $itemNode) {
$keyNode = $itemNode->getElementsByTagName('key')->item(0);
$valueNode = $itemNode->getElementsByTagName('value')->item(0);
$keyVal = new Kaltura_Client_Type_KeyValue();
$keyVal->key = $keyNode->nodeValue;
$filter = new Zend_Filter_Alnum(true);
$keyVal->value = $filter->filter($valueNode->nodeValue);
$cPlatformArray[] = $keyVal;
}
}
$object->cPlatformTvSeries = $cPlatformArray;
$object->cPlatformTvSeriesField = $this->getValue('c_platform_tv_series_field');
// because parent::getObject doesn't include empty fields
$object->feedLink = $this->getValue('feed_link');
// because parent::getObject doesn't include empty fields
return $object;
}
开发者ID:GElkayam,项目名称:server,代码行数:27,代码来源:ComcastMrssProfileConfiguration.php
示例2: radioButton
/**
* dijit.form.RadioButton
*
* @param string $id
* @param string $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array $options Array of radio options
* @param string $listsep String with which to separate options
* @return string
*/
public function radioButton(
$id,
$value = null,
array $params = array(),
array $attribs = array(),
array $options = null,
$listsep = "<br />\n"
) {
$attribs['name'] = $id;
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs = $this->_prepareDijit($attribs, $params, 'element');
if (is_array($options) && $this->_useProgrammatic() && !$this->_useProgrammaticNoScript()) {
$baseId = $id;
if (array_key_exists('id', $attribs)) {
$baseId = $attribs['id'];
}
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
foreach (array_keys($options) as $key) {
$optId = $baseId . '-' . $filter->filter($key);
$this->_createDijit($this->_dijit, $optId, array());
}
}
return $this->view->formRadio($id, $value, $attribs, $options, $listsep);
}
开发者ID:nhp,项目名称:shopware-4,代码行数:40,代码来源:RadioButton.php
示例3: getId
/**
* Get the item id
*
* @return string
*/
public function getId()
{
if (empty($this->_id)) {
$filter = new Zend_Filter_Alnum();
$filteredLabel = $filter->filter($this->getLabel());
$this->setId($filteredLabel);
}
return $this->_id;
}
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:14,代码来源:Item.php
示例4: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value contains only alphabetic and digit characters
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
if ('' === $valueString) {
$this->_error(self::STRING_EMPTY);
return false;
}
if (null === self::$_filter) {
/**
* @see Zend_Filter_Alnum
*/
require_once 'Zend/Filter/Alnum.php';
self::$_filter = new Zend_Filter_Alnum();
}
self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
if ($valueString !== self::$_filter->filter($valueString)) {
$this->_error(self::NOT_ALNUM);
return false;
}
return true;
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:36,代码来源:Alnum.php
示例5: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value contains only alphabetic and digit characters
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
if (!is_string($value) && !is_int($value) && !is_float($value)) {
$this->_error(self::INVALID);
return false;
}
$this->_setValue($value);
if ('' === $value) {
$this->_error(self::STRING_EMPTY);
return false;
}
if (null === self::$_filter) {
/**
* @see Zend_Filter_Alnum
*/
//require_once 'Zend/Filter/Alnum.php';
self::$_filter = new Zend_Filter_Alnum();
}
self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
if ($value != self::$_filter->filter($value)) {
$this->_error(self::NOT_ALNUM);
return false;
}
return true;
}
开发者ID:ddxmaaa,项目名称:wecenter-loudong,代码行数:33,代码来源:Alnum.php
示例6: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value contains only alphabetic and digit characters
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
if ('' === $valueString) {
$this->_error(self::STRING_EMPTY);
return false;
}
if (null === self::$_filter) {
/**
* @see Zend_Filter_Alnum
*/
//require-once 'Dkplus/Filter/AlnumUnderline.php';
self::$_filter = new Dkplus_Filter_AlnumUnderline();
}
self::$_filter->setMeansEnglishAlphabet($this->_meansEnglishAlphabet);
self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
if ($valueString !== self::$_filter->filter($valueString)) {
$this->_error(self::NOT_ALNUM);
return false;
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:dkplusengine,代码行数:37,代码来源:AlnumUnderline.php
示例7: oauthAction
/**
* Oauth Connect
*
*/
public function oauthAction()
{
$namespace = $this->_getOauthStorage();
$info = $namespace->info;
$users = new Users_Model_User_Table();
if (empty($info->email)) {
$row = $users->getByTwitterid($info->twitterId);
} else {
$row = $users->getByEmail($info->email);
if (!$row) {
if (self::OAUTH_FACEBOOK == $this->_getParam('type')) {
$row = $users->getByFacebookid($info->facebookId);
} elseif (self::OAUTH_GOOGLE == $this->_getParam('type')) {
$row = $users->getByGoogleid($info->googleId);
}
}
}
if (!$row) {
$loginFilter = new Zend_Filter_Alnum();
$info->login = $loginFilter->filter($info->login);
if ($users->getByLogin($info->login)) {
$form = new Users_Form_Auth_RegisterLogin();
if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) {
$info->login = $form->getValue('login');
} else {
$this->view->login = $info->login;
$this->view->form = $form;
return;
}
}
$row = $users->createRow($info->getArrayCopy());
$row->role = Users_Model_User::ROLE_USER;
$row->status = Users_Model_User::STATUS_ACTIVE;
$row->save();
}
$row->login();
$namespace->unsetAll();
$this->_helper->flashMessenger->addMessage('Now You\'re Logging!');
$this->_helper->redirector(false, false, false);
}
开发者ID:uglide,项目名称:zfcore-transition,代码行数:44,代码来源:LoginController.php
示例8: createAction
public function createAction()
{
$this->_helper->layout->disableLayout();
$filename = $this->_getParam('filename');
$alpha = new Zend_Filter_Alnum();
$filename = $alpha->filter($filename);
$filename .= '.xml';
$siteId = $this->_getParam('site_id');
$menu = new Zend_Navigation();
$gmDate = gmdate('Y-m-d');
$locales = Axis::single('locale/language')->select(array('id', 'locale'))->fetchPairs();
foreach ($locales as $languageId => &$_locale) {
$_locale = Axis_Locale::getLanguageUrl($_locale);
}
$categories = Axis::single('catalog/category')->select('*')->addName()->addKeyWord()->order('cc.lft')->addSiteFilter($siteId)->addDisabledFilter()->fetchAll();
$config = Axis::config()->sitemap;
$changefreq = $config->categories->frequency;
$priority = $config->categories->priority;
$_container = $menu;
$lvl = 0;
foreach ($categories as $_category) {
if (!isset($locales[$_category['language_id']])) {
continue;
}
$uri = $this->view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'locale' => $locales[$_category['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
$page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'visible' => 'enabled' === $_category['status'] ? true : false, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority, 'id' => $_category['id'] . $_category['language_id']));
$lvl = $lvl - $_category['lvl'] + 1;
for ($i = 0; $i < $lvl; $i++) {
$_container = $_container->getParent();
}
$lvl = $_category['lvl'];
$_container->addPage($page);
$_container = $page;
}
$products = Axis::single('catalog/product_category')->select()->distinct()->from('catalog_product_category', array())->joinLeft('catalog_product', 'cp.id = cpc.product_id', array('id'))->addName()->addKeyWord()->addActiveFilter()->addDateAvailableFilter()->addSiteFilter($siteId)->columns(array('category_id' => 'cc.id'))->fetchAll();
$changefreq = $config->products->frequency;
$priority = $config->products->priority;
foreach ($products as $_product) {
if (!isset($locales[$_product['language_id']])) {
continue;
}
$uri = $this->view->hurl(array('cat' => array('value' => $_product['id'], 'seo' => $_product['key_word']), 'locale' => $locales[$_product['language_id']], 'controller' => 'catalog', 'action' => 'view'), false, true);
$page = new Zend_Navigation_Page_Uri(array('label' => $_product['name'], 'title' => $_product['name'], 'uri' => $uri, 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
$_container = $menu->findBy('id', $_product['category_id'] . $_product['language_id']);
if (null !== $_container) {
$_container->addPage($page);
}
}
$categories = Axis::single('cms/category')->select(array('id', 'parent_id'))->addCategoryContentTable()->columns(array('ccc.link', 'ccc.title', 'ccc.language_id'))->addActiveFilter()->addSiteFilter($siteId)->where('ccc.link IS NOT NULL')->fetchAll();
$changefreq = $config->cms->frequency;
$priority = $config->cms->priority;
foreach ($categories as $_category) {
if (!isset($locales[$_category['language_id']])) {
continue;
}
$title = empty($_category['title']) ? $_category['link'] : $_category['title'];
$page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_category', 'params' => array('cat' => $_category['link'], 'locale' => $locales[$_category['language_id']]), 'id' => 'cms' . $_category['id'] . $_category['language_id'], 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
$_container = $menu->findBy('id', 'cms' . $_category['parent_id'] . $_category['language_id']);
if (null === $_container) {
$_container = $menu;
}
$_container->addPage($page);
}
$pages = array();
if ($config->cms->showPages && !empty($categories)) {
$pages = Axis::single('cms/page')->select(array('id', 'name'))->join(array('cpca' => 'cms_page_category'), 'cp.id = cpca.cms_page_id', 'cms_category_id')->join('cms_page_content', 'cp.id = cpc.cms_page_id', array('link', 'title', 'language_id'))->where('cp.is_active = 1')->where('cpca.cms_category_id IN (?)', array_keys($categories))->fetchAll();
foreach ($pages as $_page) {
$title = empty($_page['title']) ? $_page['link'] : $_page['title'];
$page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_page', 'params' => array('page' => $_page['link'], 'locale' => $locales[$_page['language_id']]), 'lastmod' => $gmDate, 'changefreq' => $changefreq, 'priority' => $priority));
$_container = $menu->findBy('id', 'cms' . $_page['cms_category_id'] . $_page['language_id']);
if (null !== $_container) {
$_container->addPage($page);
}
}
}
$content = $this->view->navigation()->sitemap($menu)->setFormatOutput(true)->setUseSitemapValidators(false)->render();
$this->getResponse()->clearAllHeaders()->setHeader('Content-Description', 'File Transfer', true)->setHeader('Content-Type', 'application/octet-stream', true)->setHeader('Content-Disposition', 'attachment; filename=' . $filename, true)->setHeader('Content-Transfer-Encoding', 'binary', true)->setHeader('Expires', '0', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Pragma', 'public', true);
$this->getResponse()->setBody($content);
}
开发者ID:rguedes,项目名称:axiscommerce,代码行数:79,代码来源:FileController.php
示例9: _load
protected function _load()
{
if (!is_array($this->_options) || empty($this->_options) || !isset($this->_options[0]) || !$this->_options[0] || preg_match('~^\\s*$~', $this->_options[0])) {
throw new Exceptions_SeotoasterException($this->_translator->translate('You should provide a form name.'));
}
if (strtolower($this->_options[0]) == 'conversioncode') {
return $this->_conversionCode($this->_options);
}
$sessionHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Session');
$useCaptcha = isset($this->_options[1]) && $this->_options[1] == 'captcha' ? true : false;
$useRecaptcha = isset($this->_options[1]) && $this->_options[1] == 'recaptcha' ? true : false;
$uploadLimitSize = is_numeric(end($this->_options)) ? end($this->_options) : self::UPLOAD_LIMIT_SIZE;
$formMapper = Application_Model_Mappers_FormMapper::getInstance();
$pageMapper = Application_Model_Mappers_PageMapper::getInstance();
$form = $formMapper->findByName($this->_options[0]);
$pageHelper = new Helpers_Action_Page();
$pageHelper->init();
if ($useCaptcha || $useRecaptcha) {
if ($form != null) {
$form->setCaptcha(1);
$formMapper->save($form);
}
if ($useRecaptcha) {
$recaptchaTheme = 'red';
$recaptchaWidgetId = uniqid('recaptcha_widget_');
if (isset($this->_options[2])) {
$recaptchaTheme = $this->_options[2];
if ($recaptchaTheme == 'custom') {
$this->_view->customRecaptcha = true;
}
}
$this->_view->recaptchaWidgetId = $recaptchaWidgetId;
$this->_view->addScriptPath($this->_websiteHelper->getPath() . 'seotoaster_core/application/views/scripts/backend/form/');
$this->_view->recaptchaCode = Tools_System_Tools::generateRecaptcha($recaptchaTheme, $recaptchaWidgetId);
}
if ($useCaptcha) {
$this->_view->captchaId = Tools_System_Tools::generateCaptcha();
}
}
if (isset($sessionHelper->toasterFormError)) {
$this->_view->toasterFormError = $sessionHelper->toasterFormError;
unset($sessionHelper->toasterFormError);
}
if (isset($sessionHelper->toasterFormSuccess)) {
$this->_view->toasterFormSuccess = $sessionHelper->toasterFormSuccess;
unset($sessionHelper->toasterFormSuccess);
}
$trackingConversionUrl = 'form-' . $this->_options[0] . '-thank-you';
$trackingConversionUrl = $pageHelper->filterUrl($trackingConversionUrl);
$trackingPageExist = $pageMapper->findByUrl($trackingConversionUrl);
if ($trackingPageExist instanceof Application_Model_Models_Page) {
$this->_view->trackingConversionUrl = $trackingConversionUrl;
}
$this->_view->useRecaptcha = $useRecaptcha;
$this->_view->useCaptcha = $useCaptcha;
$this->_view->form = Application_Model_Mappers_FormMapper::getInstance()->findByName($this->_options[0]);
$this->_view->allowMidification = Tools_Security_Acl::isAllowed(Tools_Security_Acl::RESOURCE_ADMINPANEL);
$this->_view->formName = $this->_options[0];
$this->_view->uploadLimitSize = $uploadLimitSize;
$filter = new Zend_Filter_Alnum();
$this->_view->formId = $filter->filter($this->_options[0]);
$this->_view->pageId = $this->_toasterOptions['id'];
$this->_view->websiteTmp = $this->_websiteHelper->getTmp();
$this->_view->formUrl = $this->_toasterOptions['url'];
return $this->_view->render('form.phtml');
}
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:66,代码来源:Form.php
示例10: JQueryRadio
/**
* Generates a set of radio button elements.
*
* @access public
*
* @param string|array $name If a string, the element name. If an
* array, all other parameters are ignored, and the array elements
* are extracted in place of added parameters.
*
* @param mixed $value The radio value to mark as 'checked'.
*
* @param array $options An array of key-value pairs where the array
* key is the radio value, and the array value is the radio text.
*
* @param array|string $attribs Attributes added to each radio.
*
* @return string The radio buttons XHTML.
*/
public function JQueryRadio($name, $value = null, $attribs = null, $options = null, $listsep = "\n")
{
$info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
extract($info);
// name, value, attribs, options, listsep, disable
// retrieve attributes for labels (prefixed with 'label_' or 'label')
$label_attribs = array();
foreach ($attribs as $key => $val) {
$tmp = false;
$keyLen = strlen($key);
if (6 < $keyLen && substr($key, 0, 6) == 'label_') {
$tmp = substr($key, 6);
} elseif (5 < $keyLen && substr($key, 0, 5) == 'label') {
$tmp = substr($key, 5);
}
if ($tmp) {
// make sure first char is lowercase
$tmp[0] = strtolower($tmp[0]);
$label_attribs[$tmp] = $val;
unset($attribs[$key]);
}
}
$labelPlacement = 'append';
foreach ($label_attribs as $key => $val) {
switch (strtolower($key)) {
case 'placement':
unset($label_attribs[$key]);
$val = strtolower($val);
if (in_array($val, array('prepend', 'append'))) {
$labelPlacement = $val;
}
break;
}
}
// the radio button values and labels
$options = (array) $options;
// build the element
$xhtml = '';
$list = array();
// should the name affect an array collection?
$name = $this->view->escape($name);
if ($this->_isArray && '[]' != substr($name, -2)) {
$name .= '[]';
}
// ensure value is an array to allow matching multiple times
$value = (array) $value;
// XHTML or HTML end tag?
$endTag = ' />';
if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
$endTag = '>';
}
// add radio buttons to the list.
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
foreach ($options as $opt_value => $opt_label) {
// Should the label be escaped?
if ($escape) {
$opt_label = $this->view->escape($opt_label);
}
// is it disabled?
$disabled = '';
if (true === $disable) {
$disabled = ' disabled="disabled"';
} elseif (is_array($disable) && in_array($opt_value, $disable)) {
$disabled = ' disabled="disabled"';
}
// is it checked?
$checked = '';
if (in_array($opt_value, $value)) {
$checked = ' checked="checked"';
}
// generate ID
$optId = $id . '-' . $filter->filter($opt_value);
// Wrap the radios in labels
$labelPlacement = 'prepend';
$radio = '<input type="' . $this->_inputType . '"' . ' name="' . $name . '"' . ' id="' . $optId . '"' . ' value="' . $this->view->escape($opt_value) . '"' . $checked . $disabled . $this->_htmlAttribs($attribs) . $endTag . '<label' . $this->_htmlAttribs($label_attribs) . ' for="' . $optId . '">' . $opt_label . '</label>';
// add to the array of radio buttons
$list[] = $radio;
}
// done!
$xhtml .= implode($listsep, $list);
return $xhtml;
//.........这里部分代码省略.........
开发者ID:knatorski,项目名称:SMS,代码行数:101,代码来源:JQueryRadio.php
示例11: formMultiColumnCheckbox
/**
* Generates a set of radio button elements.
*
* @access public
*
* @param string|array $name If a string, the element name. If an
* array, all other parameters are ignored, and the array elements
* are extracted in place of added parameters.
*
* @param mixed $value The radio value to mark as 'checked'.
*
* @param array $options An array of key-value pairs where the array
* key is the radio value, and the array value is the radio text.
*
* @param array|string $attribs Attributes added to each radio.
*
* @return string The radio buttons XHTML.
*/
public function formMultiColumnCheckbox($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n")
{
$info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
extract($info);
// name, value, attribs, options, listsep, disable
// retrieve attributes for labels (prefixed with 'label_' or 'label')
$label_attribs = array();
foreach ($attribs as $key => $val) {
$tmp = false;
$keyLen = strlen($key);
if (6 < $keyLen && substr($key, 0, 6) == 'label_') {
$tmp = substr($key, 6);
} elseif (5 < $keyLen && substr($key, 0, 5) == 'label') {
$tmp = substr($key, 5);
}
if ($tmp) {
// make sure first char is lowercase
$tmp[0] = strtolower($tmp[0]);
$label_attribs[$tmp] = $val;
unset($attribs[$key]);
}
}
$labelPlacement = 'append';
foreach ($label_attribs as $key => $val) {
switch (strtolower($key)) {
case 'placement':
unset($label_attribs[$key]);
$val = strtolower($val);
if (in_array($val, array('prepend', 'append'))) {
$labelPlacement = $val;
}
break;
}
}
// the radio button values and labels
$options = (array) $options;
// build the element
$xhtml = '';
$list = array();
// should the name affect an array collection?
$name = $this->view->escape($name);
if ($this->_isArray && '[]' != substr($name, -2)) {
$name .= '[]';
}
// ensure value is an array to allow matching multiple times
$value = (array) $value;
// XHTML or HTML end tag?
$endTag = ' />';
if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
$endTag = '>';
}
// add radio buttons to the list.
// require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
$column_count = 3;
$count = count($options);
$perColumn = (int) ceil($count / $column_count);
$i = $j = 0;
$columns = array();
foreach ($options as $opt_value => $opt_label) {
// Should the label be escaped?
if ($escape) {
$opt_label = $this->view->escape($opt_label);
}
// is it disabled?
$disabled = '';
if (true === $disable) {
$disabled = ' disabled="disabled"';
} elseif (is_array($disable) && in_array($opt_value, $disable)) {
$disabled = ' disabled="disabled"';
}
// is it checked?
$checked = '';
if (in_array($opt_value, $value)) {
$checked = ' checked="checked"';
}
// generate ID
$optId = $id . '-' . $filter->filter($opt_value);
// Wrap the radios in labels
$radio = '<label class="newline" ' . $this->_htmlAttribs($label_attribs) . ' for="' . $optId . '">' . ('prepend' == $labelPlacement ? $opt_label : '') . '<input type="' . $this->_inputType . '"' . ' name="' . $name . '"' . ' id="' . $optId . '"' . ' value="' . $this->view->escape($opt_value) . '"' . $checked . $disabled . $this->_htmlAttribs($attribs) . $endTag . ('append' == $labelPlacement ? $opt_label : '') . '</label>';
if ($perColumn === $i && $j < $column_count) {
$i = 0;
//.........这里部分代码省略.........
开发者ID:crlang44,项目名称:frapi,代码行数:101,代码来源:FormMultiColumnCheckbox.php
示例12: searchArtefatoDestinoAction
/**
* @return void
*/
public function searchArtefatoDestinoAction()
{
$sqArtefato = $this->getRequest()->getParam('extraParam');
$objZFAlpha = new \Zend_Filter_Alnum(true);
$query = $objZFAlpha->filter($this->getRequest()->getParam('query'));
$criteria = array('sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoProcesso(), 'sqPessoaRecebimento' => \Core_Integration_Sica_User::getPersonId(), 'sqUnidadeRecebimento' => \Core_Integration_Sica_User::getUserUnit(), 'nuArtefato' => $query, 'sqArtefato' => $sqArtefato);
$listInMyDashboard = $this->getService('ProcessoEletronico')->searchInMyDashboard($criteria);
$this->_helper->json($listInMyDashboard);
}
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:12,代码来源:DesmembrarDesentranharController.php
示例13: exportSearchExcelAction
public function exportSearchExcelAction()
{
$content = $this->getLayout()->createBlock('icc_tec/adminhtml_roster_grid')->getExcelFile();
$roster_rows = file($content['value']);
// content is just an array of where the file (et al.) has been put
$headings_row = array_shift($roster_rows);
try {
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$conn->beginTransaction();
foreach ($roster_rows as $row) {
$id = array_shift(explode(',', $row));
// first element is the id of the roster row
$roster = Mage::getModel('icc_tec/roster')->load($id);
if (is_null($roster->getInitialExportDate())) {
$roster->setInitialExportDate(time());
$roster->save();
}
}
$file_name = 'events.xml';
$zf = new Zend_Filter_Int();
$prod_id = $zf->filter($this->getRequest()->getParam('id'));
$product = Mage::getModel('catalog/product')->load($prod_id);
$zf = new Zend_Filter_Alnum();
$file_name = $zf->filter('RosterFor' . $product->getName()) . '.xml';
$this->_prepareDownloadResponse($file_name, $content);
$conn->commit();
} catch (Exception $e) {
Mage::log('Could not download and uppdate download dates for roster with. Last roster id: ' . $id . ' with exception: ' . $e->getMessage(), null, 'export-event-excel-exception.log');
$conn->rollback();
}
}
开发者ID:ankita-parashar,项目名称:magento,代码行数:31,代码来源:EventController.php
示例14: formFancySelect
public function formFancySelect($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n")
{
$info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
extract($info);
// name, value, attribs, options, listsep, disable
// retrieve attributes for labels (prefixed with 'label_' or 'label')
$label_attribs = array();
foreach ($attribs as $key => $val) {
$tmp = false;
$keyLen = strlen($key);
if (6 < $keyLen && substr($key, 0, 6) == 'label_') {
$tmp = substr($key, 6);
} elseif (5 < $keyLen && substr($key, 0, 5) == 'label') {
$tmp = substr($key, 5);
}
if ($tmp) {
// make sure first char is lowercase
$tmp[0] = strtolower($tmp[0]);
$label_attribs[$tmp] = $val;
unset($attribs[$key]);
}
}
// add class formLabelRadio to label per default
$label_attribs['class'] = (isset($label_attribs['class']) ? $label_attribs['class'] . ' ' : '') . 'formLabelRadio';
$labelPlacement = 'append';
foreach ($label_attribs as $key => $val) {
switch (strtolower($key)) {
case 'placement':
unset($label_attribs[$key]);
$val = strtolower($val);
if (in_array($val, array('prepend', 'append'))) {
$labelPlacement = $val;
}
break;
}
}
if (isset($attribs['multiple'])) {
$this->_inputType = 'checkbox';
$this->_isArray = true;
}
// the radio button values and labels
$options = (array) $options;
// build the element
$xhtml = array();
// should the name affect an array collection?
$name = $this->view->escape($name);
if ($this->_isArray && '[]' != substr($name, -2)) {
$name .= '[]';
}
// ensure value is an array to allow matching multiple times
$value = (array) $value;
// XHTML or HTML end tag?
$endTag = ' />';
if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
$endTag = '>';
}
// add container open tag
$xhtml[] = '<div class="formFancySelect">';
$xhtml[] = '<div class="formFancySelectOptions">';
$xhtml[] = '<div>';
// add radio buttons to the list.
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
foreach ($options as $opt_value => $opt_label) {
// Should the label be escaped?
if ($escape) {
$opt_label = $this->view->escape($opt_label);
}
// is it disabled?
$disabled = '';
if (true === $disable) {
$disabled = ' disabled="disabled"';
} elseif (is_array($disable) && in_array($opt_value, $disable)) {
$disabled = ' disabled="disabled"';
}
// is it checked?
$checked = '';
if (in_array($opt_value, $value)) {
$checked = ' checked="checked"';
}
// generate ID
$optId = $id . '-' . $filter->filter($opt_value);
// set class
$attribs['class'] = 'form' . ucfirst($this->_inputType);
// Wrap the radios in labels
$radio = '<label' . $this->_htmlAttribs($label_attribs) . '>' . ('prepend' == $labelPlacement ? '<span>' . $opt_label . '</span>' : '') . '<input type="' . $this->_inputType . '"' . ' name="' . $name . '"' . ' id="' . $optId . '"' . ' value="' . $this->view->escape($opt_value) . '"' . $checked . $disabled . $this->_htmlAttribs($attribs) . $endTag . ('append' == $labelPlacement ? '<span>' . $opt_label . '</span>' : '') . '</label>';
// add to the array of radio buttons
$xhtml[] = $radio;
}
// add container close tag
$xhtml[] = '</div>';
$xhtml[] = '</div>';
$xhtml[] = '</div>';
$xhtml[] = '<div class="formFancySelectLabel">';
if (isset($attribs['notice'])) {
$xhtml[] = $attribs['notice'];
}
$xhtml[] = '</div>';
if (isset($attribs['show_choice'])) {
$xhtml[] = '<div class="formFancySelectValue"></div>';
//.........这里部分代码省略.........
开发者ID:hartum,项目名称:basezf,代码行数:101,代码来源:FormFancySelect.php
示例15: formMultiText
/**
* Generates a set of radio button elements.
*
* @access public
*
* @param string|array $name If a string, the element name. If an
* array, all other parameters are ignored, and the array elements
* are extracted in place of added parameters.
*
* @param mixed $value The radio value to mark as 'checked'.
*
* @param array $options An array of key-value pairs where the array
* key is the radio value, and the array value is the radio text.
*
* @param array|string $attribs Attributes added to each radio.
*
* @return string The radio buttons XHTML.
*/
public function formMultiText($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n")
{
$info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
extract($info);
// name, value, attribs, options, listsep, disable
// the radio button values and labels
$options = (array) $options;
// build the element
$xhtml = '';
$list = array();
$checkedId = null;
// should the name affect an array collection?
$name = $this->view->escape($name);
if ($this->_isArray && '[]' != substr($name, -2)) {
$name .= '[]';
}
//get cehcked
if (isset($attribs['checked'])) {
$checkedId = $attribs['checked'];
unset($attribs['checked']);
}
// ensure value is an array to allow matching multiple times
$value = (array) $value;
// XHTML or HTML end tag?
$endTag = ' />';
if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
$endTag = '>';
}
// add radio buttons to the list.
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
$i = 0;
foreach ($options as $opt_value => $opt_label) {
// Should the label be escaped?
if ($escape) {
$opt_label = $this->view->escape($opt_label);
}
//checked
$checked = '';
if ($checkedId === $opt_value) {
$checked = 'checked="checked"';
}
// is it disabled?
$disabled = '';
if (true === $disable) {
$disabled = ' disabled="disabled"';
} elseif (is_array($disable) && in_array($opt_value, $disable)) {
$disabled = ' disabled="disabled"';
}
// generate ID
$optId = $id . '-' . $filter->filter($opt_value);
// Wrap the textareas
$radio = '<div>' . '<input style="float: left;" type="radio" ' . ' name="right_' . substr($name, 0, -2) . '"' . ' value="' . $i . '"' . $checked . $endTag . '<textarea ' . ' name="' . $name . '"' . $disabled . $this->_htmlAttribs($attribs) . '>' . $this->view->escape($opt_label) . '</textarea>' . '<input type="hidden" ' . ' name="id_' . $name . '"' . ' value="' . $this->view->escape($opt_value) . '"' . $endTag . '</div>';
// add to the array of radio buttons
$list[] = $radio;
$i++;
}
// done!
$xhtml .= implode($listsep, $list);
return $xhtml;
}
开发者ID:abdala,项目名称:la,代码行数:79,代码来源:FormMultiText.php
示例16: getAlnum
/**
* Returns only the alphabetic characters and digits in value.
*
* @deprecated since 0.8.0
* @param mixed $value
* @return string
*/
public static function getAlnum($value)
{
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
return $filter->filter($value);
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:Filter.php
示例17: testRadioLabelContainsForAttributeTag
public function testRadioLabelContainsForAttributeTag()
{
$options = array('foo bar' => 'Foo', 'bar baz' => 'Bar', 'baz' => 'Baz');
$html = $this->helper->formRadio(array('name' => 'foo[bar]', 'value' => 'bar', 'options' => $options));
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
foreach ($options as $key => $value) {
$id = 'foo-bar-' . $filter->filter($key);
$this->assertRegexp('/<label([^>]*)(for="' . $id . '")/', $html);
}
}
开发者ID:travisj,项目名称:zf,代码行数:11,代码来源:FormRadioTest.php
示例18: formFancySelect
public function formFancySelect($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n")
{
$info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
extract($info);
// name, id, value, attribs, options, listsep, disable
// get label
$label = isset($attribs['label']) ? $attribs['label'] : null;
unset($attribs['label']);
// get notice
$notice = isset($attribs['notice']) ? $attribs['notice'] : null;
unset($attribs['notice']);
// get notice
$showChoice = isset($attribs['show_choice']) ? $attribs['show_choice'] : false;
unset($attribs['show_choice']);
// get label attribs
$labelAttribs = $this->getAttribsNamespaceValue($attribs, 'label');
// is multiple choice
if (isset($attribs['multiple'])) {
$this->_inputType = 'checkbox';
$this->_isArray = true;
unset($attribs['multiple']);
}
// the radio button values and labels
$options = (array) $options;
// build the element
$xhtml = array();
// should the name affect an array collection?
$name = $this->view->escape($name);
if ($this->_isArray && '[]' != substr($name, -2)) {
$name .= '[]';
}
// ensure value is an array to allow matching multiple times
$value = (array) $value;
// XHTML or HTML end tag?
$endTag = ' />';
if ($this->view instanceof Zend_View_Abstract && !$this->view->doctype()->isXhtml()) {
$endTag = '>';
}
// add container open tag
$xhtml[] = '<div id="' . $this->view->escape($id) . '" class="formFancySelect">';
$xhtml[] = ' <div class="formFancySelectOptions">';
$xhtml[] = ' <div>';
// add
|
请发表评论