예제 #1
0
 public function getagentpermissionsAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         if (!$this->getRequest()->isXmlHttpRequest()) {
             $this->view->msg = 'Not Ajax Request';
             $this->_forward('error', 'error');
         } else {
             $filterChain = new Zend_Filter();
             $filterChain->addFilter(new Zend_Filter_Digits())->addFilter(new Zend_Filter_StripTags());
             $zoneId = $filterChain->filter($_POST['ZONE_ID']);
             $contextId = $filterChain->filter($_POST['CONTEXT_ID']);
             $agentId = $filterChain->filter($_POST['AGENT_ID']);
             $permissions = Permission::getAllAgentPermissions($agentId, $zoneId, $contextId);
             if (count($permissions) > 0) {
                 $json = Zend_Json::encode($permissions);
                 $this->view->json = $json;
             }
             $this->render('ajaxsuccessjson');
         }
     } else {
         if (!$this->getRequest()->isXmlHttpRequest()) {
             $this->view->msg = 'Not Ajax Request';
             $this->_forward('error', 'error');
         } else {
             $this->view->msg = 'Invalid User';
             $this->_forward('error', 'error');
         }
     }
 }
예제 #2
0
function vtEditExpressions($adb, $appStrings, $current_language, $theme, $formodule = '')
{
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $smarty = new vtigerCRM_Smarty();
    $smarty->assign('APP', $appStrings);
    $mod = array_merge(return_module_language($current_language, 'FieldFormulas'), return_module_language($current_language, 'Settings'));
    $jsStrings = array('NEED_TO_ADD_A' => $mod['NEED_TO_ADD_A'], 'CUSTOM_FIELD' => $mod['LBL_CUSTOM_FIELD'], 'LBL_USE_FUNCTION_DASHDASH' => $mod['LBL_USE_FUNCTION_DASHDASH'], 'LBL_USE_FIELD_VALUE_DASHDASH' => $mod['LBL_USE_FIELD_VALUE_DASHDASH'], 'LBL_DELETE_EXPRESSION_CONFIRM' => $mod['LBL_DELETE_EXPRESSION_CONFIRM']);
    $smarty->assign("JS_STRINGS", Zend_Json::encode($jsStrings));
    $smarty->assign("MOD", $mod);
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE_NAME", 'FieldFormulas');
    $smarty->assign("PAGE_NAME", 'LBL_FIELDFORMULAS');
    $smarty->assign("PAGE_TITLE", 'LBL_FIELDFORMULAS');
    $smarty->assign("PAGE_DESC", 'LBL_FIELDFORMULAS_DESCRIPTION');
    $smarty->assign("FORMODULE", $formodule);
    if (file_exists("modules/{$formodule}/{$formodule}.php")) {
        $focus = CRMEntity::getInstance($formodule);
        $validationArray = split_validationdataArray(getDBValidationData($focus->tab_name, getTabid($formodule)));
        $smarty->assign('VALIDATION_DATA_FIELDNAME', $validationArray['fieldname']);
        $smarty->assign('VALIDATION_DATA_FIELDDATATYPE', $validationArray['datatype']);
        $smarty->assign('VALIDATION_DATA_FIELDLABEL', $validationArray['fieldlabel']);
    }
    $smarty->display(vtlib_getModuleTemplate('FieldFormulas', 'EditExpressions.tpl'));
}
예제 #3
0
 /**
  * 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);
 }
예제 #4
0
 public function statisticsAction()
 {
     $request = $this->getRequest()->getParams();
     $option = isset($request['option']) ? $request['option'] : 'data';
     if ($option == 'data') {
         $doc_type = isset($request['doc_type']) && $request['doc_type'] != '' ? $request['doc_type'] : null;
         $transaction_type = isset($request['transaction_type']) && $request['transaction_type'] != '' ? $request['transaction_type'] : null;
     } else {
         $doc_type = isset($request['doc_type']) && $request['doc_type'] != '' ? json_encode(explode(',', $request['doc_type'])) : null;
         $transaction_type = isset($request['transaction_type']) && $request['transaction_type'] != '' ? json_encode(explode(',', $request['transaction_type'])) : null;
     }
     $warehouse_type = isset($request['warehouse_type']) && $request['warehouse_type'] != 'null' ? $request['warehouse_type'] : null;
     $warehouse = isset($request['warehouse']) && $request['warehouse'] != 'null' ? $request['warehouse'] : null;
     $key = isset($request['key']) ? $request['key'] : '';
     $date_from = isset($request['date_from']) ? $request['date_from'] : date('Y-m-01');
     $date_to = isset($request['date_to']) ? $request['date_to'] : date('Y-m-t');
     $page = isset($request['page']) ? $request['page'] : 1;
     $limit = isset($request['limit']) ? $request['limit'] : 0;
     $stock = new Erp_Model_Stock_Stock();
     // 查询条件
     $condition = array('warehouse_type' => $warehouse_type, 'warehouse' => $warehouse, 'doc_type' => $doc_type, 'transaction_type' => $transaction_type, 'key' => $key, 'date_from' => $date_from, 'date_to' => $date_to, 'page' => $page, 'limit' => $limit, 'type' => $option);
     $data = $stock->getStatisticsData($condition);
     if ($option == 'csv') {
         $this->view->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         $h = new Application_Model_Helpers();
         $h->exportCsv($data, '库存交易统计');
     } else {
         echo Zend_Json::encode($data);
     }
     exit;
 }
 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     if ('product.info.options.configurable' == $this->getNameInLayout() && 'true' != (string) Mage::getConfig()->getNode('modules/Amasty_Stockstatus/active')) {
         $allProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct());
         $_attributes = $this->getProduct()->getTypeInstance(true)->getConfigurableAttributes($this->getProduct());
         foreach ($allProducts as $product) {
             $key = array();
             foreach ($_attributes as $attribute) {
                 $key[] = $product->getData($attribute->getData('product_attribute')->getData('attribute_code'));
             }
             $stockStatus = '';
             $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
             if (!$product->isInStock()) {
                 $stockStatus = Mage::helper('amxnotif')->__('Out of Stock');
             }
             if ($key) {
                 $aStockStatus[implode(',', $key)] = array('is_in_stock' => $product->isSaleable(), 'custom_status' => $stockStatus, 'is_qnt_0' => (int) ($product->isInStock() && $stockItem->getData('qty') <= 0), 'product_id' => $product->getId(), 'stockalert' => Mage::helper('amxnotif')->getStockAlert($product, $this->helper('customer')->isLoggedIn()));
             }
         }
         foreach ($aStockStatus as $k => $v) {
             if (!$v['is_in_stock'] && !$v['custom_status']) {
                 $v['custom_status'] = Mage::helper('amxnotif')->__('Out of Stock');
                 $aStockStatus[$k] = $v;
             }
         }
         $html = '<script type="text/javascript">var stStatus = new StockStatus(' . Zend_Json::encode($aStockStatus) . ');</script>' . $html;
     }
     return $html;
 }
예제 #6
0
 public function viewAction()
 {
     // Sociel Gaming
     $app = $this->getApplication();
     $option = $this->getCurrentOptionValue();
     $current_game = new Socialgaming_Model_Game();
     $current_game->findCurrent($app->getId());
     if (!$current_game->getId()) {
         $current_game->findDefault();
     }
     list($start, $end) = $current_game->getFromDateToDate();
     $log = new LoyaltyCard_Model_Customer_Log();
     $customers = $log->getBestCustomers($app->getId(), $start->toString('y-MM-dd HH:mm:ss'), $end->toString('y-MM-dd HH:mm:ss'), false);
     $team_leader = $customers->current();
     $customers->removeCurrent();
     $this->loadPartials($this->getFullActionName('_') . '_l' . $this->_layout_id, false);
     $this->getLayout()->getPartial('content')->setCurrentGame($current_game)->setTeamLeader($team_leader)->setCustomers($customers);
     $html = array('html' => $this->getLayout()->render());
     if ($url = $option->getBackgroundImageUrl()) {
         $html['background_image_url'] = $url;
     }
     $html['use_homepage_background_image'] = (int) $option->getUseHomepageBackgroundImage() && !$option->getHasBackgroundImage();
     $html['title'] = $option->getTabbarName();
     $this->getLayout()->setHtml(Zend_Json::encode($html));
 }
예제 #7
0
 /**
  * Initial connect function to get the user details and also to check the user tocken
  */
 public function connectAction()
 {
     $this->_getSession()->unsSignup();
     $token = $this->getRequest()->getParam('token');
     $host = $this->getRequest()->getParam('host');
     //Load the user object with the bc-token
     $user = App_Main::getModel('stages/user')->load($token, 'bc_auth_token');
     //login and redirect to homepage if the user is already registered
     if ($user->getId()) {
         $user->setSessionUser($user);
         echo Zend_Json::encode(array('redirect' => App_Main::getUrl('')));
         return;
     }
     //Get the Basecamp connect object
     $bcConnect = new Connect_Basecamp($host, $token, 'X', 'xml');
     $userXml = $bcConnect->getMe();
     if (!empty($userXml['body']) && $userXml['status'] == '200 OK') {
         $userArray = App_Main::getHelper('stages')->XMLToArray($userXml['body']);
         $return = array('success' => 1, 'username' => $userArray['user-name'], 'firstname' => $userArray['first-name'], 'lastname' => $userArray['last-name'], 'avatar' => $userArray['avatar-url'], 'token' => $userArray['token']);
         $signUp = App_Main::getModel('core/object');
         $signUp->setMode('bc_token_connect');
         $signUp->setToken($token);
         $signUp->setHost($host);
         $this->_getSession()->setSignup($signUp);
     } else {
         $return = array('success' => 0);
     }
     echo Zend_Json::encode($return);
 }
function vtGetExpressionListJson($adb, $request)
{
    $moduleName = $request['modulename'];
    $ee = new VTModuleExpressionsManager($adb);
    $arr = $ee->expressionsForModule($moduleName);
    echo Zend_Json::encode($arr);
}
예제 #9
0
 /**
  * Add merge vars to list
  */
 public function varsToListAction()
 {
     $listId = $this->getRequest()->getPost('list_id', null);
     if ($listId) {
         $api = Mage::getModel('monkey/api');
         $e = explode('&', $this->getRequest()->getPost('merge_vars'));
         $mergeVars = array();
         foreach ($e as $val) {
             $m = explode('=', $val);
             $mergeVars[$m[0]] = $m[1];
         }
         $options = array();
         foreach ($mergeVars as $tag => $name) {
             //Date for some fields, format is "MM/DD/YYYY"
             if ($tag == 'PTSSPENT' || $tag == 'PTSEARN' || $tag == 'PTSEXP') {
                 $options['field_type'] = 'date';
             } else {
                 //We add a new mergevar for INT points.
                 if ($tag == 'PTS') {
                     $options = array('field_type' => 'number');
                     $api->listMergeVarAdd($listId, "POINTS", "Points", $options);
                     $options = array();
                 }
             }
             $api->listMergeVarAdd($listId, $tag, $name, $options);
             $options = array();
         }
     }
     $this->getResponse()->setBody(Zend_Json::encode(array()));
 }
예제 #10
0
 public function fetchEmailsInFolderAction()
 {
     $tblQueue = new Pandamp_Modules_Misc_Email_Model_Queue();
     $rowset = $tblQueue->fetchAll();
     $a = array();
     $a['totalCount'] = count($rowset);
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['email'][$i]['qid'] = $row->newsletterQID;
             $a['email'][$i]['sender'] = $row->sender;
             $a['email'][$i]['recepientMail'] = $row->recepientMail;
             $a['email'][$i]['recepientName'] = $row->recepientName;
             $a['email'][$i]['subject'] = $row->subject;
             $a['email'][$i]['SendDate'] = Pandamp_Lib_Formater::get_date($row->SendDate);
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['email'][0]['qid'] = '';
         $a['email'][0]['sender'] = '';
         $a['email'][0]['recepientMail'] = '';
         $a['email'][0]['recepientName'] = '';
         $a['email'][0]['subject'] = '';
         $a['email'][0]['SendDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
예제 #11
0
 /**
  * Add fields to form and create template info form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Template Information'), 'class' => 'fieldset-wide'));
     $templateId = $this->getEmailTemplate()->getId();
     if ($templateId) {
         $fieldset->addField('used_currently_for', 'label', array('label' => Mage::helper('adminhtml')->__('Used Currently For'), 'container_id' => 'used_currently_for', 'after_element_html' => '<script type="text/javascript">' . (!$this->getEmailTemplate()->getSystemConfigPathsWhereUsedCurrently() ? '$(\'' . 'used_currently_for' . '\').hide(); ' : '') . '</script>'));
     }
     if (!$templateId) {
         $fieldset->addField('used_default_for', 'label', array('label' => Mage::helper('adminhtml')->__('Used as Default For'), 'container_id' => 'used_default_for', 'after_element_html' => '<script type="text/javascript">' . (!(bool) $this->getEmailTemplate()->getOrigTemplateCode() ? '$(\'' . 'used_default_for' . '\').hide(); ' : '') . '</script>'));
     }
     $fieldset->addField('template_code', 'text', array('name' => 'template_code', 'label' => Mage::helper('adminhtml')->__('Template Name'), 'required' => true));
     $fieldset->addField('template_subject', 'text', array('name' => 'template_subject', 'label' => Mage::helper('adminhtml')->__('Template Subject'), 'required' => true));
     $fieldset->addField('orig_template_variables', 'hidden', array('name' => 'orig_template_variables'));
     $fieldset->addField('variables', 'hidden', array('name' => 'variables', 'value' => Zend_Json::encode($this->getVariables())));
     $fieldset->addField('template_variables', 'hidden', array('name' => 'template_variables'));
     $insertVariableButton = $this->getLayout()->createBlock('adminhtml/widget_button', '', array('type' => 'button', 'label' => Mage::helper('adminhtml')->__('Insert Variable...'), 'onclick' => 'templateControl.openVariableChooser();return false;'));
     $fieldset->addField('insert_variable', 'note', array('text' => $insertVariableButton->toHtml()));
     $fieldset->addField('template_text', 'textarea', array('name' => 'template_text', 'label' => Mage::helper('adminhtml')->__('Template Content'), 'title' => Mage::helper('adminhtml')->__('Template Content'), 'required' => true, 'style' => 'height:24em;'));
     if (!$this->getEmailTemplate()->isPlain()) {
         $fieldset->addField('template_styles', 'textarea', array('name' => 'template_styles', 'label' => Mage::helper('adminhtml')->__('Template Styles'), 'container_id' => 'field_template_styles'));
     }
     if ($templateId) {
         $form->addValues($this->getEmailTemplate()->getData());
     }
     if ($values = Mage::getSingleton('adminhtml/session')->getData('email_template_form_data', true)) {
         $form->setValues($values);
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
<?php if ($_valid && !is_callable('content_56087a12baeb7')) {function content_56087a12baeb7($_smarty_tpl) {?>
<div class="container-fluid"><div class="contents row-fluid"><?php $_smarty_tpl->tpl_vars['WIDTHTYPE'] = new Smarty_variable($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('rowheight'), null, 0);?><form id="OutgoingServerForm" class="form-horizontal" data-detail-url="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->getDetailViewUrl();?>
" method="POST"><div class="widget_header row-fluid"><div class="span8"><h3><?php echo vtranslate('LBL_OUTGOING_SERVER',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</h3>&nbsp;<?php echo vtranslate('LBL_OUTGOING_SERVER_DESC',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</div><div class="span4 btn-toolbar"><div class="pull-right"><button class="btn btn-success saveButton" type="submit" title="<?php echo vtranslate('LBL_SAVE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
"><strong><?php echo vtranslate('LBL_SAVE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</strong></button><a type="reset" class="cancelLink" title="<?php echo vtranslate('LBL_CANCEL',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
"><?php echo vtranslate('LBL_CANCEL',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</a></div></div></div><hr><input type="hidden" name="default" value="false" /><input type="hidden" name="server_port" value="0" /><input type="hidden" name="server_type" value="email" /><input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->get('id');?>
" /><div class="row-fluid hide errorMessage"><div class="alert alert-error"><?php echo vtranslate('LBL_TESTMAILSTATUS',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
<strong><?php echo vtranslate('LBL_MAILSENDERROR',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</strong></div></div><table class="table table-bordered table-condensed themeTableColor"><thead><tr class="blockHeader"><th colspan="2" class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><?php echo vtranslate('LBL_MAIL_SERVER_SMTP',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</th></tr></thead><tbody><tr><td width="20%" class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><label class="muted pull-right marginRight10px"><span class="redColor">*</span><?php echo vtranslate('LBL_SERVER_NAME',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</label></td><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
" style="border-left: none;"><input type="text" name="server" data-validation-engine='validate[required]' value="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->get('server');?>
" /></td></tr><tr><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><label class="muted pull-right marginRight10px"><?php echo vtranslate('LBL_USER_NAME',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</label></td><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
" style="border-left: none;"><input type="text" name="server_username" value="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->get('server_username');?>
"</td></tr><tr><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><label class="muted pull-right marginRight10px"><?php echo vtranslate('LBL_PASSWORD',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</label></td><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
" style="border-left: none;"><input type="password" name="server_password" value="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->get('server_password');?>
"</td></tr><tr><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><label class="muted pull-right marginRight10px"><?php echo vtranslate('LBL_FROM_EMAIL',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</label></td><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
" style="border-left: none;"><input type="text" name="from_email_field" data-validation-engine="validate[funcCall[Vtiger_Base_Validator_Js.invokeValidation]]" data-validator='<?php echo Zend_Json::encode(array(array('name'=>'Email')));?>
' value="<?php echo $_smarty_tpl->tpl_vars['MODEL']->value->get('from_email_field');?>
"</td></tr><tr><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
"><label class="muted pull-right marginRight10px"><?php echo vtranslate('LBL_REQUIRES_AUTHENTICATION',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</label></td><td class="<?php echo $_smarty_tpl->tpl_vars['WIDTHTYPE']->value;?>
" style="border-left: none;"><input type="checkbox" name="smtp_auth" <?php if ($_smarty_tpl->tpl_vars['MODEL']->value->isSmtpAuthEnabled()){?>checked<?php }?>/></td></tr></tbody></table><br><div class="alert alert-info"><?php echo vtranslate('LBL_OUTGOING_SERVER_NOTE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</div></form></div></div><?php }} ?>
예제 #13
0
 public function calculationSettingsChangeAction()
 {
     $this->getHelper('viewRenderer')->setNoRender();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = $request->getPost();
         if (!isset($post['changeSet']) || empty($post['changeSet'])) {
             $this->ajaxException("Nieprawidłowa wartość parametrów");
             return;
         } else {
             $data = Zend_Json::decode($post['changeSet']);
             for ($i = 0; $i < $data['formsCount']; $i++) {
                 $form = $data[$i];
                 if (count($form['changes']) == 0) {
                     Logic_FormsTracker::invalidate(Zend_Session::getId() . '_' . $form['trackingName'], Zend_Auth::getInstance()->getIdentity()->id);
                 } else {
                     Logic_FormsTracker::store(Zend_Session::getId(), $form['trackingName'], $form['changes']);
                 }
             }
             echo Zend_Json::encode(array('result' => 'success', 'message' => 'ok'));
         }
     } else {
         $this->ajaxException("Bad request");
         return;
     }
 }
예제 #14
0
 public function tradAction()
 {
     $this->disableLayout();
     $this->disableViewAutoRender();
     //		Pimcore\Model\Translation\AbstractTranslation::clearDependentCache();
     if ($admin) {
         $list = new Pimcore\Model\Translation\Admin\Listing();
     } else {
         $list = new Pimcore\Model\Translation\Website\Listing();
     }
     $list->setOrder("asc");
     $list->setOrderKey("key");
     $condition = false;
     //	$this->getGridFilterCondition();
     if ($condition) {
         $list->setCondition($condition);
     }
     $list->load();
     $translations = array();
     $translationObjects = $list->getTranslations();
     $lang = $this->language == "fr" ? "fr_FR" : $this->language;
     foreach ($translationObjects as $t) {
         if ($t->getTranslation($lang) and $t->getKey()) {
             $tab['store'][$this->language]["translation"][$t->getKey()] = $t->getTranslation($lang);
         }
         //getTranslations();
     }
     $tab['lng'] = $this->language;
     $this->getResponse()->setHeader('Content-Type', 'text/javascript')->appendBody(\Zend_Json::encode($tab));
 }
    function content_5694a5cf68a7b($_smarty_tpl)
    {
        $_smarty_tpl->tpl_vars["FIELD_INFO"] = new Smarty_variable(Vtiger_Util_Helper::toSafeHTML(Zend_Json::encode($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldInfo())), null, 0);
        $_smarty_tpl->tpl_vars["SPECIAL_VALIDATOR"] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getValidator(), null, 0);
        ?>
<input id="<?php 
        echo $_smarty_tpl->tpl_vars['MODULE']->value;
        ?>
_editView_fieldName_<?php 
        echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('name');
        ?>
" type="text" class="input-large" data-validation-engine="validate[<?php 
        if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->isMandatory() == true) {
            ?>
 required,<?php 
        }
        ?>
funcCall[Vtiger_Base_Validator_Js.invokeValidation]]" name="<?php 
        echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldName();
        ?>
"value="<?php 
        echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('fieldvalue');
        ?>
" data-fieldinfo='<?php 
        echo $_smarty_tpl->tpl_vars['FIELD_INFO']->value;
        ?>
' <?php 
        if (!empty($_smarty_tpl->tpl_vars['SPECIAL_VALIDATOR']->value)) {
            ?>
data-validator=<?php 
            echo Zend_Json::encode($_smarty_tpl->tpl_vars['SPECIAL_VALIDATOR']->value);
        }
        ?>
 /><?php 
    }
예제 #16
0
 protected function _toHtml()
 {
     $localeCode = Mage::app()->getLocale()->getLocaleCode();
     // get days names
     $days = Zend_Locale_Data::getList($localeCode, 'days');
     $this->assign('days', array('wide' => Zend_Json::encode(array_values($days['format']['wide'])), 'abbreviated' => Zend_Json::encode(array_values($days['format']['abbreviated']))));
     // get months names
     $months = Zend_Locale_Data::getList($localeCode, 'months');
     $this->assign('months', array('wide' => Zend_Json::encode(array_values($months['format']['wide'])), 'abbreviated' => Zend_Json::encode(array_values($months['format']['abbreviated']))));
     // get "today" and "week" words
     $this->assign('today', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'relative', 0)));
     $this->assign('week', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'field', 'week')));
     // get "am" & "pm" words
     $this->assign('am', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'am')));
     $this->assign('pm', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'pm')));
     // get first day of week and weekend days
     $this->assign('firstDay', (int) Mage::getStoreConfig('general/locale/firstday'));
     $this->assign('weekendDays', Zend_Json::encode((string) Mage::getStoreConfig('general/locale/weekend')));
     // define default format and tooltip format
     $this->assign('defaultFormat', Zend_Json::encode(Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM)));
     $this->assign('toolTipFormat', Zend_Json::encode(Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_LONG)));
     // get days and months for en_US locale - calendar will parse exactly in this locale
     $days = Zend_Locale_Data::getList('en_US', 'days');
     $months = Zend_Locale_Data::getList('en_US', 'months');
     $enUS = new stdClass();
     $enUS->m = new stdClass();
     $enUS->m->wide = array_values($months['format']['wide']);
     $enUS->m->abbr = array_values($months['format']['abbreviated']);
     $this->assign('enUS', Zend_Json::encode($enUS));
     return parent::_toHtml();
 }
 public function runAction()
 {
     try {
         $feed = $this->_getFeedModel();
         $mode = $this->getRequest()->getParam('mode');
         if (!$mode || $mode == 'new') {
             $feed->getGenerator()->getState()->reset();
         }
         $this->getResponse()->clearBody();
         $result = array('success' => true, 'message' => '');
         $feed->generate();
         $state = $feed->getGenerator()->getState();
         $result['status'] = $state->getStatus();
         $result['success'] = true;
         if ($state->isReady()) {
             $result['message'] = __('Feed file was generated at <a target="_blank" href="' . $feed->getUrl() . '?rand=' . microtime(true) . '">' . $feed->getUrl() . '</a>');
         } elseif ($state->isProcessing() || $state->isError()) {
             $result['message'] = nl2br($feed->getGenerator()->getState()->toHtml());
         }
     } catch (Exception $e) {
         $result['success'] = false;
         $result['message'] = $e->getMessage();
     }
     $this->getResponse()->setBody(Zend_Json::encode($result));
 }
    function content_54d2436e8ce6e($_smarty_tpl)
    {
        ?>
<!DOCTYPE html><html><head><title><?php 
        echo vtranslate($_smarty_tpl->tpl_vars['PAGETITLE']->value, $_smarty_tpl->tpl_vars['MODULE_NAME']->value);
        ?>
</title><link REL="SHORTCUT ICON" HREF="layouts/vlayout/skins/images/favicon.ico"><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" href="libraries/jquery/chosen/chosen.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/jquery-ui/css/custom-theme/jquery-ui-1.8.16.custom.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/select2/select2.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/bootstrap/css/bootstrap.css" type="text/css" media="screen" /><link rel="stylesheet" href="resources/styles.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/posabsolute-jQuery-Validation-Engine/css/validationEngine.jquery.css" /><link rel="stylesheet" href="libraries/jquery/select2/select2.css" /><link rel="stylesheet" href="libraries/guidersjs/guiders-1.2.6.css"/><link rel="stylesheet" href="libraries/jquery/pnotify/jquery.pnotify.default.css"/><link rel="stylesheet" href="libraries/jquery/pnotify/use for pines style icons/jquery.pnotify.default.icons.css"/><link rel="stylesheet" media="screen" type="text/css" href="libraries/jquery/datepicker/css/datepicker.css" /><?php 
        $_smarty_tpl->tpl_vars['cssModel'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['cssModel']->_loop = false;
        $_smarty_tpl->tpl_vars['index'] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['STYLES']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['cssModel']->key => $_smarty_tpl->tpl_vars['cssModel']->value) {
            $_smarty_tpl->tpl_vars['cssModel']->_loop = true;
            $_smarty_tpl->tpl_vars['index']->value = $_smarty_tpl->tpl_vars['cssModel']->key;
            ?>
<link rel="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getRel();
            ?>
" href="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getHref();
            ?>
?&v=<?php 
            echo $_smarty_tpl->tpl_vars['VTIGER_VERSION']->value;
            ?>
" type="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getType();
            ?>
" media="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getMedia();
            ?>
" /><?php 
        }
        ?>
<style type="text/css">@media print {.noprint { display:none; }}</style><script type="text/javascript" src="libraries/jquery/jquery.min.js"></script></head><body data-skinpath="<?php 
        echo $_smarty_tpl->tpl_vars['SKIN_PATH']->value;
        ?>
" data-language="<?php 
        echo $_smarty_tpl->tpl_vars['LANGUAGE']->value;
        ?>
"><div id="js_strings" class="hide noprint"><?php 
        echo Zend_Json::encode($_smarty_tpl->tpl_vars['LANGUAGE_STRINGS']->value);
        ?>
</div><?php 
        $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL'] = new Smarty_variable(Users_Record_Model::getCurrentUserModel(), null, 0);
        ?>
<input type="hidden" id="start_day" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('dayoftheweek');
        ?>
" /><input type="hidden" id="row_type" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('rowheight');
        ?>
" /><input type="hidden" id="current_user_id" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('id');
        ?>
" /><div id="page"><!-- container which holds data temporarly for pjax calls --><div id="pjaxContainer" class="hide noprint"></div>
<?php 
    }
예제 #19
0
 function NoteBookCreate(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     $userModel = Users_Record_Model::getCurrentUserModel();
     $linkId = $request->get('linkId');
     $noteBookName = $request->get('notePadName');
     $noteBookContent = $request->get('notePadContent');
     $blockid = $request->get('blockid');
     $isdefault = $request->get('isdefault');
     $width = $request->get('width');
     $height = $request->get('height');
     $date_var = date("Y-m-d H:i:s");
     $date = $adb->formatDate($date_var, true);
     $dataValue = array();
     $dataValue['contents'] = $noteBookContent;
     $dataValue['lastSavedOn'] = $date;
     $data = Zend_Json::encode((object) $dataValue);
     $size = Zend_Json::encode(array('width' => $width, 'height' => $height));
     $query = "INSERT INTO vtiger_module_dashboard(`linkid`, `blockid`, `filterid`, `title`, `data`, `isdefault`, `size`) VALUES(?,?,?,?,?,?,?)";
     $params = array($linkId, $blockid, 0, $noteBookName, $data, $isdefault, $size);
     $adb->pquery($query, $params);
     $id = $adb->getLastInsertID();
     $result = array();
     $result['success'] = TRUE;
     $result['widgetId'] = $id;
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
 /**
  * Execute tasks group
  *
  */
 public function AjaxExecuteTaskGroupAction()
 {
     $groupCode = $this->getRequest()->getParam('group_code');
     $group = mage::getResourceModel('BackgroundTask/Taskgroup')->loadByGroupCode($groupCode);
     $hasError = 0;
     $hasFinished = 0;
     $progressPercent = 0;
     try {
         $group->execute();
     } catch (Exception $ex) {
         $hasError = 1;
     }
     //set values
     $progressPercent = $group->getProgressPercent();
     if ((int) $progressPercent >= 100) {
         $hasFinished = 1;
     }
     //return result
     $response = array();
     $response['error'] = $hasError;
     $response['finished'] = $hasFinished;
     $response['progress'] = $progressPercent;
     $response = Zend_Json::encode($response);
     $this->getResponse()->setBody($response);
 }
예제 #21
0
파일: Captcha.php 프로젝트: drunkvegas/done
    public function getHtml()
    {
        if (Mage::getStoreConfig('webforms/captcha/api') != 'ajax') {
            return parent::getHtml();
        }
        $return = "";
        $div_id = "webform_recaptcha";
        if (Mage::registry('webform')) {
            $div_id = "webform_" . Mage::registry('webform')->getId() . "_recaptcha";
        }
        $return .= <<<HTML
\t\t<div id="{$div_id}"></div>
HTML;
        $return .= <<<SCRIPT
<script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
SCRIPT;
        if (!empty($this->_options)) {
            $encoded = Zend_Json::encode($this->_options);
        }
        $return .= <<<SCRIPT
<script type="text/javascript">
\tRecaptcha.create("{$this->_publicKey}", "{$div_id}", {$encoded});
</script>
SCRIPT;
        return $return;
    }
예제 #22
0
 /**
  * 获取菜单
  */
 public function getmenusAction()
 {
     // 请求参数
     $request = $this->getRequest()->getParams();
     // 请求菜单的层级ID
     $parent_id = isset($request['parent_id']) ? $request['parent_id'] : 0;
     $option = isset($request['option']) ? $request['option'] : null;
     $menu = new Home_Model_Menu();
     //echo date('H:i:s').'<br>';
     if ($option == 'treedata') {
         echo Zend_Json::encode($menu->getTreeData($parent_id));
     } else {
         $data = $menu->getMenuData($parent_id);
         /* echo '<pre>';
            print_r($data);
            exit; */
         $json = Zend_Json::encode($data);
         $patterns[0] = '/"disabled":"0"/';
         $patterns[1] = '/"disabled":"1"/';
         $patterns[2] = '/"handler":"menuClick"/';
         $replacements[2] = '"disabled":0';
         $replacements[1] = '"disabled":1';
         $replacements[0] = '"handler":menuClick';
         // 转换JSON中的数据格式(临时解决办法)
         echo preg_replace($patterns, $replacements, $json);
     }
     //echo date('H:i:s').'<br>';
     exit;
 }
예제 #23
0
 /**
  * Get Current Rate 
  * @return JSON Data
  */
 function getCurrentRateJson()
 {
     $db = $this->getAdapter();
     $sql = "SELECT `id`,`in_cur_id`,`out_cur_id`,`rate_in`,`rate_out`\r\n\t\t\t\tFROM `cs_rate` as r\r\n    \t\t\tWHERE r.`active` = 1\r\n\t\t\t\tORDER BY r.`in_cur_id`, r.`out_cur_id`";
     $rows = $db->fetchAll($sql);
     return Zend_Json::encode($rows);
 }
<?php if ($_valid && !is_callable('content_56059c18e4bca')) {function content_56059c18e4bca($_smarty_tpl) {?>
<?php $_smarty_tpl->tpl_vars["FIELD_INFO"] = new Smarty_variable(Zend_Json::encode($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldInfo()), null, 0);?><div class="row-fluid"><?php $_smarty_tpl->tpl_vars['ASSIGNED_USER_ID'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('name'), null, 0);?><?php $_smarty_tpl->tpl_vars['ALL_ACTIVEUSER_LIST'] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->getAccessibleUsers(), null, 0);?><?php $_smarty_tpl->tpl_vars['SEARCH_VALUES'] = new Smarty_variable(explode(',',$_smarty_tpl->tpl_vars['SEARCH_INFO']->value['searchValue']), null, 0);?><?php $_smarty_tpl->tpl_vars['SEARCH_VALUES'] = new Smarty_variable(array_map("trim",$_smarty_tpl->tpl_vars['SEARCH_VALUES']->value), null, 0);?><?php if ($_smarty_tpl->tpl_vars['ASSIGNED_USER_ID']->value!='modifiedby'){?><?php $_smarty_tpl->tpl_vars['ALL_ACTIVEGROUP_LIST'] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->getAccessibleGroups(), null, 0);?><?php }else{ ?><?php $_smarty_tpl->tpl_vars['ALL_ACTIVEGROUP_LIST'] = new Smarty_variable(array(), null, 0);?><?php }?><?php $_smarty_tpl->tpl_vars['ACCESSIBLE_USER_LIST'] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->getAccessibleUsersForModule($_smarty_tpl->tpl_vars['MODULE']->value), null, 0);?><?php $_smarty_tpl->tpl_vars['ACCESSIBLE_GROUP_LIST'] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->getAccessibleGroupForModule($_smarty_tpl->tpl_vars['MODULE']->value), null, 0);?><select class="select2 listSearchContributor span10 <?php echo $_smarty_tpl->tpl_vars['ASSIGNED_USER_ID']->value;?>
"  name="<?php echo $_smarty_tpl->tpl_vars['ASSIGNED_USER_ID']->value;?>
" multiple style="width:150px;"data-fieldinfo='<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['FIELD_INFO']->value, ENT_QUOTES, 'UTF-8', true);?>
'><optgroup label="<?php echo vtranslate('LBL_USERS');?>
"><?php  $_smarty_tpl->tpl_vars['OWNER_NAME'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['OWNER_NAME']->_loop = false;
 $_smarty_tpl->tpl_vars['OWNER_ID'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['ALL_ACTIVEUSER_LIST']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['OWNER_NAME']->key => $_smarty_tpl->tpl_vars['OWNER_NAME']->value){
$_smarty_tpl->tpl_vars['OWNER_NAME']->_loop = true;
 $_smarty_tpl->tpl_vars['OWNER_ID']->value = $_smarty_tpl->tpl_vars['OWNER_NAME']->key;
?><option value="<?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
" data-picklistvalue= '<?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
' <?php if (in_array(trim(decode_html($_smarty_tpl->tpl_vars['OWNER_NAME']->value)),$_smarty_tpl->tpl_vars['SEARCH_VALUES']->value)){?> selected <?php }?><?php if (array_key_exists($_smarty_tpl->tpl_vars['OWNER_ID']->value,$_smarty_tpl->tpl_vars['ACCESSIBLE_USER_LIST']->value)){?> data-recordaccess=true <?php }else{ ?> data-recordaccess=false <?php }?>data-userId="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_ID']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
</option><?php } ?></optgroup><?php if (count($_smarty_tpl->tpl_vars['ALL_ACTIVEGROUP_LIST']->value)>0){?><optgroup label="<?php echo vtranslate('LBL_GROUPS');?>
"><?php  $_smarty_tpl->tpl_vars['OWNER_NAME'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['OWNER_NAME']->_loop = false;
 $_smarty_tpl->tpl_vars['OWNER_ID'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['ALL_ACTIVEGROUP_LIST']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['OWNER_NAME']->key => $_smarty_tpl->tpl_vars['OWNER_NAME']->value){
$_smarty_tpl->tpl_vars['OWNER_NAME']->_loop = true;
 $_smarty_tpl->tpl_vars['OWNER_ID']->value = $_smarty_tpl->tpl_vars['OWNER_NAME']->key;
?><option value="<?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
" data-picklistvalue= '<?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
' <?php if (in_array(trim($_smarty_tpl->tpl_vars['OWNER_NAME']->value),$_smarty_tpl->tpl_vars['SEARCH_VALUES']->value)){?> selected <?php }?><?php if (array_key_exists($_smarty_tpl->tpl_vars['OWNER_ID']->value,$_smarty_tpl->tpl_vars['ACCESSIBLE_GROUP_LIST']->value)){?> data-recordaccess=true <?php }else{ ?> data-recordaccess=false <?php }?> ><?php echo $_smarty_tpl->tpl_vars['OWNER_NAME']->value;?>
</option><?php } ?></optgroup><?php }?></select></div><?php }} ?>
예제 #25
0
 public function saveAction()
 {
     if ($datas = $this->getRequest()->getPost()) {
         try {
             if (!empty($datas["name"])) {
                 if (is_numeric(substr($datas["name"], 0, 1))) {
                     throw new Exception("Ce champ ne peut pas commencer par un chiffre");
                 }
                 $this->getApplication()->setName($datas['name'])->save();
             } else {
                 if (!empty($datas['bundle_id'])) {
                     if (count(explode('.', $datas['bundle_id'])) < 2) {
                         throw new Exception($this->_('The entered bundle id is incorrect, it should be like: com.siberiancms.app'));
                     }
                     $this->getApplication()->setBundleId($datas['bundle_id'])->save();
                 } else {
                     throw new Exception($this->_('An error occurred while saving. Please try again later.'));
                 }
             }
             $html = array('success' => '1');
         } catch (Exception $e) {
             $html = array('message' => $e->getMessage());
         }
         $this->getLayout()->setHtml(Zend_Json::encode($html));
     }
 }
 /**
  * Index Action
  *
  */
 public function indexAction()
 {
     if ($this->getRequest()->getParam('isAjax', false)) {
         Mage_AdminNotification_Model_Survey::saveSurveyViewed(true);
     }
     $this->getResponse()->setBody(Zend_Json::encode(array('survey_decision_saved' => 1)));
 }
예제 #27
0
 /**
  * DataStore view helper.
  *
  * @param string $id JavaScript id for the data store.
  * @param string $dojoType DojoType of the data store (e.g., dojox.data.QueryReadStore)
  * @param array $attribs Attributes for the data store.
  */
 public function dataStore($id = '', $dojoType = '', array $attribs = array())
 {
     if (!$id || !$dojoType) {
         throw new Zend_Exception('Invalid arguments: required jsId and dojoType.');
     }
     $this->dojo->requireModule($dojoType);
     // Programmatic
     if ($this->_useProgrammatic()) {
         if (!$this->_useProgrammaticNoScript()) {
             $this->dojo->addJavascript('var ' . $id . ";\n");
             $js = $id . ' = ' . 'new ' . $dojoType . '(' . Zend_Json::encode($attribs) . ");";
             $this->dojo->_addZendLoad("function(){{$js}}");
         }
         return '';
     }
     // Set extra attribs for declarative
     if (!array_key_exists('id', $attribs)) {
         $attribs['id'] = $id;
     }
     if (!array_key_exists('jsId', $attribs)) {
         $attribs['jsId'] = $id;
     }
     if (!array_key_exists('dojoType', $attribs)) {
         $attribs['dojoType'] = $dojoType;
     }
     return '<div' . $this->_htmlAttribs($attribs) . "></div>\n";
 }
예제 #28
0
 public function errorAction()
 {
     $http_accept = $_SERVER['HTTP_ACCEPT'];
     $this->_redirecUnknownImage($http_accept);
     $errors = $this->_getParam('error_handler');
     $msg = $errors->exception->getMessage();
     $backTrace = $errors->exception->getTraceAsString();
     $this->_handleMessage($errors);
     $this->_helper->viewRenderer->setViewScriptPathSpec('error/' . $this->getResponse()->getHttpResponseCode() . '.:suffix');
     $this->view->exception = $errors->exception;
     $this->view->request = $errors->request;
     $this->view->ui = 1;
     $logPath = realpath(APPLICATION_PATH . '/../log') . "/error";
     if (!is_dir($logPath)) {
         mkdir($logPath, 755, TRUE);
     }
     $log = new Zend_Log(new Zend_Log_Writer_Stream($logPath . "/" . date("Ymd") . "_applicationException.log"));
     $params1 = $this->_request->getParams();
     unset($params1["error_handler"]);
     $params = Zend_Json::encode($params1);
     $messages = array($msg, $backTrace, $params, "HTTP_ACCEPT: " . $http_accept, "");
     $log->err(implode(self::LOG_EOL, $messages));
     try {
         self::$_dispatcher->notify(new sfEvent($this, 'error.log', array('message' => array($msg, $backTrace), 'priority' => 3)));
         return;
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
예제 #29
0
파일: Json.php 프로젝트: Cryde/sydney-core
 /**
  * Encode data as JSON, disable layouts, and set response header
  *
  * If $keepLayouts is true, does not disable layouts.
  * If $encodeJson is false, does not JSON-encode $data
  *
  * @param  mixed $data
  * @param  bool $keepLayouts
  * NOTE:   if boolean, establish $keepLayouts to true|false
  *         if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
  *         this array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false
  *         that will not be passed to Zend_Json::encode method but will be used here
  * @param  bool $encodeData
  * @return string|void
  */
 public function json($data, $keepLayouts = false, $encodeData = true)
 {
     $options = array();
     if (is_array($keepLayouts)) {
         $options = $keepLayouts;
         $keepLayouts = false;
         if (array_key_exists('keepLayouts', $options)) {
             $keepLayouts = $options['keepLayouts'];
             unset($options['keepLayouts']);
         }
         if (array_key_exists('encodeData', $options)) {
             $encodeData = $options['encodeData'];
             unset($options['encodeData']);
         }
     }
     if ($encodeData) {
         $data = Zend_Json::encode($data, null, $options);
     }
     if (!$keepLayouts) {
         require_once 'Zend/Layout.php';
         $layout = Zend_Layout::getMvcInstance();
         if ($layout instanceof Zend_Layout) {
             $layout->disableLayout();
         }
     }
     $response = Zend_Controller_Front::getInstance()->getResponse();
     $response->setHeader('Content-Type', 'application/json', true);
     return $data;
 }
예제 #30
0
 public function getCustomOptions()
 {
     $customOptions = array();
     $customOptionsColl = Mage::getModel('catalog/product_option')->getCollection();
     $customOptionsColl->getSelect()->joinLeft(array('type_value' => $customOptionsColl->getTable('catalog/product_option_type_value')), 'main_table.option_id = type_value.option_id', array('option_type_id' => 'type_value.option_type_id'))->joinLeft(array('type_price' => $customOptionsColl->getTable('catalog/product_option_type_price')), 'type_value.option_type_id = type_price.option_type_id', array('o_price' => 'type_price.price', 'o_price_type' => 'type_price.price_type'))->joinLeft(array('price' => $customOptionsColl->getTable('catalog/product_option_price')), 'main_table.option_id = price.option_id', array('price' => 'price.price', 'price_type' => 'price.price_type'))->where('main_table.product_id = ?', $this->getProduct()->getId());
     foreach ($customOptionsColl->getData() as $option) {
         if (!is_null($option['option_type_id'])) {
             $option['price'] = $option['o_price'];
             $option['price_type'] = $option['o_price_type'];
             unset($option['o_price']);
             unset($option['o_price_type']);
             $customOptions['o_' . $option['option_type_id']] = $option;
         } else {
             unset($option['o_price']);
             unset($option['o_price_type']);
             $customOptions[$option['option_id']] = $option;
         }
     }
     $store = $this->getProduct()->getStore();
     foreach ($customOptions as $key => $option) {
         if ($option['price_type'] == 'percent') {
             continue;
         }
         $customOptions[$key]['price'] = $this->__currencyByStore($option['price'], $store, false, false);
     }
     return Zend_Json::encode($customOptions);
 }