/** Get all publications * @param string $sort field to sort by * @param string $params['title'] title of book * @param string $params['authorEditor'] author or editor name * @param string $params['pubYear'] year of publishing * @param string $params['place'] place of publication * @param integer $params['page'] page to retrieve * @return array */ public function getPublications($sort, $params) { $refs = $this->getAdapter(); $select = $refs->select()->from($this->_name)->order($sort); if (isset($params['title']) && $params['title'] != "") { $title = strip_tags($params['title']); $select->where('title LIKE ?', '%' . $title . '%'); } if (isset($params['authorEditor']) && $params['authorEditor'] != "") { $author = strip_tags($params['authorEditor']); $select->where('authors LIKE ?', '%' . $author . '%'); } if (isset($params['pubYear']) && $params['pubYear'] != "") { $pubYear = strip_tags($params['pubYear']); $select->where('publication_year = ?', $pubYear); } if (isset($params['place']) && $params['place'] != "") { $place = strip_tags($params['place']); $select->where('publication_place LIKE ?', '%' . $place . '%'); } $paginator = Zend_Paginator::factory($select); $cache = Zend_registry::get('cache'); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } $paginator->setItemCountPerPage(20)->setPageRange(10); return $paginator; }
function __construct($mailType, $subject, $scriptPath, $template = null) { // Keep the context objects $this->_db = Zend_Db_Table::getDefaultAdapter(); // get the config from the registry $registry = Zend_registry::getInstance(); $this->_config = $registry->get("Config"); // Get the Zmax context for translations $zmax_context = $registry->get("zmax_context"); $this->_texts = $zmax_context->texts; $this->_mailType = $mailType; $this->_from = $this->_config['chairMail']; $this->_subject = $subject; $this->_copyToChair = false; // Special case of a mail sent to the chair. // NOTE: the chair is assumed to be in User. Is it really safe ? if ($mailType == self::PC_CHAIR) { $this->setTo($this->_config->chairMail); $this->_mailType = self::SOME_USER; } // Default format: text $this->_mailFormat = self::FORMAT_TEXT; // Create a template engine to instantiate template mails $this->_view = new Zmax_View_Phplib(); $this->_view->setPath($scriptPath); // Put configuration information in the view (always useful) $this->_config->putInView($this->_view); // Record the template if ($template != null) { $this->setTemplate($template); } // Put config information in the view: always useful $this->_config->putInView($this->_view); }
function configAction() { // When the form is submitted $form_mess = ""; if (isset($_POST['confName'])) { $form_mess = $this->updateConfig($_POST, $this->db_v1, $this->view, $this->session); $this->config_v1 = GetConfig($this->db_v1); // Check whether the logo file has been transmitted $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setDestination('images/'); $adapter->addValidator('IsImage', false); if ($adapter->receive()) { $name = $adapter->getFileName('logo_file'); //récupérer le nom du fichier sans avoir tout le chemin $name = basename($name); $this->db_v1->execRequete("UPDATE Config SET logo_file='{$name}'"); } $config = new Config(); $this->config = $config->fetchAll()->current(); $this->config->putInView($this->view); $registry = Zend_registry::getInstance(); $registry->set("Config", $this->config); } $this->view->config_message = $form_mess; $this->instantiateConfigVars($this->config_v1, $this->view); $this->view->setFile("content", "config.xml"); $this->view->setFile("form_config", "form_config.xml"); $form_mess = ""; $this->view->messages = $form_mess; // N.B: the config values ar eput in the views by the Myreview controller echo $this->view->render("layout"); }
/** * Generates the adapter * * @param array $db The DB connection * @param string|Zend_Locale $locale OPTIONAL Locale/Language to set, identical with locale identifier, * see Zend_Locale for more information * @param array $options OPTIONAL Options to set */ public function __construct($db, $locale = null, array $options = array()) { // If $db is null: nothing to do. if ($db == null) { return; } // Keep the db reference for possible use $this->db = $db; // Check whether the view system is PHPLIB. In yes we // add all the translations as entities in the view object // Get the utilitary objects from the registry $registry = Zend_registry::getInstance(); $zmax_context = $registry->get("zmax_context"); $config = $zmax_context->config; // By default we take the zmax context view, unless it is explicitly given if (isset($options['view'])) { $this->phplib_view = $options['view']; } else { if ($config->view->zmax_view_system == "phplib") { $this->phplib_view = $zmax_context->view; } } // Now call the parent constructor // Adding this option is necessary starting with Zend 1.6, to prevent // an ugly message $options['disableNotices'] = 'true'; parent::__construct($db, $locale, $options); }
public function checkChatKeyValidity() { $return = null; $showId = $this->getRequest()->getParam('User')->currentShow; $session = $this->getRequest()->getParam('User')->getSessionKey(); $chatKey = $this->getRequest()->getParam('User')->chatroomKey; if ($chatKey) { try { $stmt = Zend_registry::get('dbh')->proc('show_viewer_authenticate'); $stmt->bindParam(':show', $showId, PDO::PARAM_INT); $stmt->bindParam(':session', $session, PDO::PARAM_STR); $stmt->bindParam(':key', $chatKey, PDO::PARAM_STR); $stmt->execute(); $result = $stmt->fetch(Zend_Db::FETCH_OBJ); $stmt->closeCursor(); } catch (Zend_Db_Statement_Exception $e) { echo $e->getMessage(); die(__LINE__); } if ($result) { $return = $result->show; } } return $return; }
/** * Get all carrier */ public function getAll() { $db = Zend_registry::get('db'); $select = $db->select()->from("operadoras"); $stmt = $db->query($select); $carrier = $stmt->fetchAll(); return $carrier; }
public function __construct($spec, $params = array(), $options = null) { parent::__construct($spec, $options); $this->_lang = empty($options['lang']) ? 1 : $options['lang']; if ($options['mode'] == 'add') { $this->_mode = 'add'; $config = Zend_registry::get('config'); $this->_lang = $config->defaultEditLanguage; } $this->_params = $params; }
/** * send youtube mail every day in week 2 * @param void * @return void */ public function youtubeAction() { $this->_helper->viewRenderer->setNoRender(); # in this case Zend_Registry::get('week') will be used as day of the week in model $day = $this->_request->getParam('day'); $dayObj = $day; $day += 7; Zend_registry::set('day', $day); Zend_Debug::dump(new Admin_Model_Youtube($dayObj)); Zend_Debug::dump($day); }
public function get_sum_operations_group_by_month($id, $filter) { $where = ' WHERE ' . $this->parse_filter(isset($filter['filter']) ? $filter['filter'] : array(), $join); if (is_array($id) && count($id)) { $where .= " AND `fin_category_id` IN (" . Zend_registry::get('target')->db->escape(trim(implode(',', $id), ',')) . ")"; } elseif (!empty($id)) { $id = (int) $id; $where .= " AND `fin_category_id` = '{$id}' "; } return Zend_Registry::get('target')->db->get_results("SELECT date_format(fin_op.`date`, '%m.%Y') as Mon, fin_op.`fin_category_id`, SUM(fin_op.`operation_sum`) as sum, fin_cat.`category_name`\n\t\t\t\tFROM {$this->table} AS fin_op LEFT JOIN {$this->_financial_cat} as fin_cat ON fin_cat.`id` = fin_op.`fin_category_id` {$where} GROUP BY MONTH(fin_op.`date`),`fin_category_id` ORDER BY Mon,fin_op.`fin_category_id`;\n\t\t\t"); }
public function subscribe_decline_price($gift_id, $email, $name, $price) { $gift_id = (int) $gift_id; $price = (int) $price; $email = Zend_Registry::get('target')->db->escape($email); $user_name = Zend_registry::get('target')->db->escape($name); if (!$gift_id) { return false; } Zend_Registry::get('target')->db->query("INSERT INTO {$this->table} (gift_id, email,user_name,old_price) VALUES ({$gift_id}, '{$email}','{$name}',{$price}) ON DUPLICATE KEY UPDATE status=0,old_price={$price};"); return true; }
public function __construct($options = null) { parent::__construct($options); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); $decorator = array('SimpleInput'); $decoratorSelect = array('SelectInput'); $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('comments'); $comment_author_IP = new Zend_Form_Element_Hidden('user_ip'); $comment_author_IP->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->addValidator('Ip')->setValue($_SERVER['REMOTE_ADDR']); $comment_agent = new Zend_Form_Element_Hidden('user_agent'); $comment_agent->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setValue($_SERVER['HTTP_USER_AGENT'])->setRequired(true); $comment_subject = new Zend_Form_Element_Hidden('comment_subject'); $comment_subject->removeDecorator('HtmlTag')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setRequired(true); $comment_findID = new Zend_Form_Element_Hidden('comment_findID'); $comment_findID->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('Int'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $comment_author = new Zend_Form_Element_Text('comment_author'); $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid name!')->setDecorators($decorators); $comment_author_email = new Zend_Form_Element_Text('comment_author_email'); $comment_author_email->setLabel('Enter your email address: ')->setDecorators($decorators)->setRequired(true)->setAttrib('size', 40)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('EmailAddress')->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public'); $comment_type = new Zend_Form_Element_Select('comment_type'); $comment_type->setLabel('Error type: ')->setRequired(true)->setDecorators($decorators)->addMultiOptions(array(NULL => NULL, 'Choose error type' => array('Incorrect ID' => 'Incorrect identification', 'More info' => 'I have further information', 'Incorrect image' => 'Incorrect image', 'Incorrect parish' => 'Incorrect parish', 'Grid reference issues' => 'Grid reference wrong', 'Date found wrong' => 'Date of discovery wrong', 'Spelling errors' => 'Spelling errors', 'Duplicated record' => 'Duplicated record', 'Data problems apparent' => 'Data problems', 'Other' => 'Other reason')))->addErrorMessage('You must enter an error report type'); $comment_author_url = new Zend_Form_Element_Text('comment_author_url'); $comment_author_url->setLabel('Enter your web address: ')->setDecorators($decorators)->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->setDescription('* Not compulsory'); $comment_content = new Pas_Form_Element_RTE('comment_content'); $comment_content->setLabel('Enter your comment: ')->setRequired(true)->addFilter('StringTrim')->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Basic')->addFilter('StringTrim')->addFilter('WordChars')->addFilter('HtmlBody')->addFilter('EmptyParagraph')->addErrorMessage('Please enter something in the comments box!'); $config = Zend_registry::get('config'); $privateKey = $config->recaptcha->privatekey; $pubKey = $config->recaptcha->pubkey; $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Prove you are not a robot you varmint!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean'))); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $this->addElements(array($comment_findID, $comment_author_IP, $comment_agent, $comment_subject, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $captcha, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'captcha', 'submit'), 'details'); } else { $this->addElements(array($comment_findID, $comment_subject, $comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'submit'), 'details'); } $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Enter your error report: '); }
public function preDispatch(Zend_Controller_Request_Abstract $request) { if ($acl = Zend_registry::get('Acl')) { if ($user = $request->getParam('User', null)) { if (($roles = $user->getRoles()) && count($roles)) { $clientRole = $roles[0]; $clientHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Client'); $client = $clientHelper->loadByGroup($clientRole->id); $request->setParam('Client', $client); $request->getParam('View')->register_object('client', $client); } } } }
function init() { // Same as the parent parent::init(); // Get the utilitary objects from the registry $registry = Zend_registry::getInstance(); // Instantiate a Config object with all config values. Put it in the registry // (can be accessed by models) and in the controller. $config = new Config(); $this->config = $config->fetchAll()->current(); $this->config->putInView($this->view); $registry->set("Config", $this->config); /// The following is for backward compatibility with V1. To be removed eventually. // Initialize the $db_v1 object, using the Version DB interface. $db_config = $this->zmax_context->config->db->params; $this->db_v1 = new BD($db_config->username, $db_config->password, $db_config->dbname, $db_config->host); // Load the translations for the myreview namespace $this->zmax_context->texts->addTranslation($this->zmax_context->db, $this->zmax_context->locale, array("namespaces" => array('author', 'reviewer', 'admin', 'mail', 'attendee'))); // Load the configuration of MyReview. Put the values in the view $this->config_v1 = GetConfig($this->db_v1); // Get the codes of the application (V1). $this->codes = new Codes("Codes.xml"); // Keep the lang in the controller $this->lang = $this->zmax_context->locale->getLanguage(); $this->view->conf_name = $this->config_v1['confName']; $this->view->page_title = ""; // Check whether the user is connected $this->texts = $this->zmax_context->texts; $this->session = $this->user = null; if (!$this->checkSession()) { $this->view->user_status = $this->texts->user_not_connected; // Propose the links to create and account or log in $this->view->account_mngt = $this->texts->def->create_account; $this->view->account_mngt_link = "createaccount"; $this->view->login_logout = $this->texts->def->log_in; $this->view->login_logout_link = "login"; } else { $logoutLink = $this->view->base_url . "/index/logout"; $this->view->user_status = $this->zmax_context->texts->you_are_currently_connected . " " . $this->user->first_name . " <b>" . $this->user->last_name . "</b>."; // Propose the links to edit account and account or log out $this->view->account_mngt = $this->texts->author->edit_account_header; $this->view->account_mngt_link = "editaccount"; $this->view->login_logout = $this->texts->def->log_out; $this->view->login_logout_link = "logout"; } // Put the user and the session in the registry $registry->set("session", $this->session); $registry->set("user", $this->user); }
private function _fetchYear() { $year = null; if (Zend_registry::isRegistered('argv')) { $argv = Zend_Registry::get('argv'); if (isset($argv[1]) and is_numeric($argv[1])) { $year = $argv[1]; } } elseif (APPLICATION_ENV == 'testing') { $year = 2010; } else { if (isset($_GET['year']) and is_numeric($_GET['year'])) { $year = $_GET['year']; } } return $year; }
/** * Sets the CAS parameters for authentication * * @return void */ public function __construct($cas_url, $request) { $this->request = $request; // Get the utilitary objects from the registry $registry = Zend_registry::getInstance(); // Get the Zmax context $zmax_context = $registry->get("zmax_context"); // Store the URL of the CAS server and the base URL $this->cas_url = $cas_url; $this->base_url = $zmax_context->config->app->base_url; // Compute the URL of the current action $this->controller = $request->getControllerName(); $this->module = $request->getModuleName(); if (empty($this->module)) { $this->module = "default"; } }
public function __get($v) { $var = '_' . $v; if (0 === strpos($v, 'is') && strtoupper($v[2]) === $v[2]) { $allowed = Zend_registry::get('Acl')->has(trim(substr($v, 2))); return $allowed; } if (isset($this->{$v})) { return $this->{$v}; } else { if (isset($this->_session()->{$v})) { return strval($this->_session()->{$v}); } elseif (isset($this->_details->{$v})) { return $this->_details->{$v}; } } return null; }
function __construct($scriptPath) { // Keep the context objects $this->_db = Zend_Db_Table::getDefaultAdapter(); // get the config from the registry $registry = Zend_registry::getInstance(); $this->_config = $registry->get("Config"); // Get the Zmax context for translations $zmax_context = $registry->get("zmax_context"); $this->_texts = $zmax_context->texts; // Create a template engine to instantiate template mails $this->_view = new Zmax_View_Phplib(); $this->_view->setPath($scriptPath); // Put configuration information in the view (always useful) $this->_config->putInView($this->_view); // Files are always created in the upload area $this->_filePath = $zmax_context->config->app->upload_path; }
protected function _load($showId = null, $method = null, $preview = 0, $offset = 0, $limit = null, array $portals = array(), array $channels = array(), $series = null, $start = null, $finish = null, $exclude = null, $searchTerm = null, $searchFilter = null, $transcript = null) { $user = $this->getRequest()->getParam('User'); $args = array('type' => $method ? $method : $this->getRequest()->getParam('action', null), 'userId' => $user->id, 'ip' => Showcase_Session::getRemoteIp($this->getRequest()), 'cache' => $user->isCmsUser ? false : true, 'preview' => $user->isCmsUser ? $preview : 0, 'portals' => $user->isCmsUser ? count($portals) ? implode(', ', $portals) : null : $this->getRequest()->getParam('Portal')->id, 'channels' => count($channels) ? implode(', ', $channels) : ($this->getRequest()->getParam('Channel', null) ? $this->getRequest()->getParam('Channel')->id : null), 'series' => $series, 'offset' => $offset, 'limit' => $limit, 'start' => $start ? new Zend_Date($start, Zend_registry::get('locale')) : null, 'finish' => $finish ? new Zend_Date($finish, Zend_registry::get('locale')) : null, 'show' => $showId, 'exclude' => $exclude, 'search' => $searchTerm, 'filter' => $searchFilter, 'transcript' => $transcript); $return = null; if ($args['cache']) { $id = $this->_makeId($method, $args); if ($this->_cache()->test($id)) { $return = unserialize($this->_cache()->load($id)); } } if (!$return) { $return = call_user_func_array(array($this, '_factory'), $args); if ($args['cache']) { $this->_cache()->save(serialize($return), $id); } } return $return; }
/** * Constructor * * Registers form view helper as decorator * * @param mixed $options * @return void */ public function __construct($select, $numberOfColumns, $itemViewscript = null, $options = null) { $this->_db = Zend_registry::get('db'); $_frontController = Zend_Controller_Front::getInstance(); $this->_request = $_frontController->getRequest(); if (null === $this->_view) { require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->_view = $viewRenderer->view; } if (!empty($options['paginationViewScript'])) { $this->_view->assign('paginationViewScript', $options['paginationViewScript']); } else { $this->_view->assign('paginationViewScript', null); } $this->_view->assign('numberOfColumns', $numberOfColumns); $this->_view->assign('itemViewScript', $itemViewscript); $adapter = new Zend_Paginator_Adapter_DbSelect($select); $paginator = new Zend_Paginator($adapter); $_config = Zend_Registry::get('config'); $itemPerPage = 12; if (!empty($_config->products->itemPerPage)) { $itemPerPage = $_config->products->itemPerPage; } if (!empty($options['list_options']['perPage'])) { $itemPerPage = $options['list_options']['perPage']; } if ($this->_request->getParam('perPage')) { $itemPerPage = $this->_request->getParam('perPage') == 'all' ? $paginator->getTotalItemCount() : $this->_request->getParam('perPage'); } $pageRange = 5; if (!empty($_config->products->pageRange)) { $pageRange = $_config->products->pageRange; } $paginator->setItemCountPerPage($itemPerPage); $paginator->setCurrentPageNumber($this->_request->getParam('page')); $paginator->setPageRange($pageRange); $this->_view->assign('paginator', $paginator); }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { $displayLogin = true; if ($user = $request->getParam('User', null)) { if ("-1" !== $user->getUserId()) { $displayLogin = false; $acl = Showcase_Acl::factory($user->getRoles()); // Only load the Users ACL roles and resources Zend_registry::set('Acl', $acl); // Register the Acl for user access } else { $displayLogin = true; Zend_registry::set('Acl', NULL); // Register the Acl for user access } } if ($displayLogin) { if ("include" !== strtolower($request->getActionName()) && "static" !== strtolower($request->getControllerName())) { $request->setModuleName('default')->setControllerName('Login')->setActionName('index')->setDispatched(false); } } }
/** * Constructor * * Registers form view helper as decorator * * @param mixed $options * @return void */ public function __construct($select, $tables, $field_list, $options = null) { $this->_db = Zend_registry::get('db'); $_frontController = Zend_Controller_Front::getInstance(); $this->_request = $_frontController->getRequest(); if (null === $this->_view) { require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->_view = $viewRenderer->view; } if (!empty($options['actionKey'])) { $this->_view->actionKey = $options['actionKey']; } if (!empty($options['commands'])) { $this->_view->assign('commands', $options['commands']); } if (!empty($options['to-excel-action'])) { $this->_view->assign('to_excel_action', $options['to-excel-action']); } else { $this->_view->assign('to_excel_action', 'to-excel'); } if (!empty($options['disable-export-to-excel'])) { $this->_view->assign('disable_export_to_excel', $options['disable-export-to-excel']); } else { $this->_view->assign('disable_export_to_excel', 'false'); } if (!empty($options['enable-print'])) { $this->_view->assign('enable_print', $options['enable-print']); $this->_view->headScript()->appendFile($this->_view->locateFile('jquery.printElement.min.js')); } else { $this->_view->assign('enable_print', 'false'); } if (!empty($options['filters'])) { $this->_view->assign('filters', $options['filters']); foreach ($options['filters'] as $key => $filter) { $filter_val = $this->_request->getParam($key); if (!empty($filter_val)) { if ($filter['associatedTo'] != '') { if (!empty($filter['kindOfFilter']) && $filter['kindOfFilter'] == 'list') { $select->where("{$filter['associatedTo']} = '{$filter_val}'\r\n OR {$filter['associatedTo']} like '%{$filter_val}%'\r\n OR {$filter['associatedTo']} like '%,{$filter_val}'\r\n OR {$filter['associatedTo']} like '{$filter_val},%'\r\n OR {$filter['associatedTo']} like '%,{$filter_val},%'\r\n "); } else { $select->where("{$filter['associatedTo']} = ?", $filter_val); } } } } } else { $this->_view->assign('filters', array()); } if (!empty($options['action_panel'])) { if (!empty($options['action_panel'])) { $field_list['action_panel'] = $options['action_panel']; } if (!empty($options['action_panel']['actions'])) { $this->_view->assign('action_links', $options['action_panel']['actions']); } } $this->_view->assign('field_list', $field_list); if ($this->_request->getParam('order')) { if (in_array($this->_request->getParam('order'), array_keys($field_list))) { $direction = 'ASC'; if (in_array($this->_request->getParam('order-direction'), array('ASC', 'DESC'))) { $direction = $this->_request->getParam('order-direction'); } $select->order("{$this->_request->getParam('order')} {$direction}"); $this->_view->assign('order', $this->_request->getParam('order')); $this->_view->assign('order_direction', $this->_request->getParam('order-direction')); } } $searchfor = $this->_request->getParam('searchfor'); if ($searchfor) { $searching_on = array(); $search_keywords = explode(' ', $searchfor); foreach ($tables as $table => $columns) { foreach ($columns as $column) { $doSearch = true; if (isset($options['onlyColumns'])) { if (!in_array($column, $options['onlyColumns'])) { $doSearch = false; } } else { if (isset($options['excludedColums'])) { if (in_array($column, $options['excludedColums'])) { $doSearch = false; } } } if ($doSearch == true) { array_push($searching_on, $this->_db->quoteInto("{$table}.{$column} LIKE ?", "%{$searchfor}%")); foreach ($search_keywords as $keyword) { array_push($searching_on, $this->_db->quoteInto("{$table}.{$column} LIKE ?", "%{$keyword}%")); } } } } if (!empty($searching_on)) { $select->where(implode(' OR ', $searching_on)); } } $this->_view->assign('searchfor', $searchfor); $adapter = new Zend_Paginator_Adapter_DbSelect($select); $paginator = new Zend_Paginator($adapter); $_config = Zend_Registry::get('config'); $itemPerPage = 10; if (!empty($_config->lists->itemPerPage)) { $itemPerPage = $_config->lists->itemPerPage; } if (!empty($options['list_options']['perPage'])) { $itemPerPage = $options['list_options']['perPage']; } if ($this->_request->getParam('perPage')) { $itemPerPage = $this->_request->getParam('perPage') == 'all' ? $paginator->getTotalItemCount() : $this->_request->getParam('perPage'); } $pageRange = 5; if (!empty($_config->lists->pageRange)) { $pageRange = $_config->lists->pageRange; } $paginator->setItemCountPerPage($itemPerPage); $paginator->setCurrentPageNumber($this->_request->getParam('page')); $paginator->setPageRange($pageRange); $this->_view->assign('paginator', $paginator); }
public function loadItem($id) { $menuItem = new MenuItem(); $select = $menuItem->select(); $select->from('MenuItemData', array('MID_Style', 'MID_Secured', 'MID_loadImage', 'MID_Show', 'MID_Image', 'MID_ImgAndTitle'))->setIntegrityCheck(false)->joinInner('MenuItemIndex', 'MID_ID = MII_MenuItemDataID', array('MII_Title', 'MII_Link', 'MII_PageID', 'MII_Placeholder'))->where('MII_LanguageID = ?', Zend_registry::get('currentEditLanguage'))->where('MID_ID = ?', $id); $row = $menuItem->fetchRow($select); if ($row) { $isPage = $row['MII_PageID'] != -1; $menuItemType = 'page'; if ($row['MII_Placeholder']) { $menuItemType = 'placeholder'; } if (!empty($row['MII_Link'])) { $menuItemType = 'external'; } $tmp = array('MenuTitle' => $row['MII_Title'] != '' ? $row['MII_Title'] : '', 'MenuLink' => $row['MII_Link'] != '' ? $row['MII_Link'] : '', 'menuItemSecured' => $row['MID_Secured'], 'menuImage' => $row['MID_Image'], 'loadImage' => $row['MID_loadImage'], 'MID_Show' => $row['MID_Show'], 'menuImgAndTitle' => $row['MID_ImgAndTitle'], 'menuItemType' => $menuItemType, 'pagePicker' => $isPage ? $row['MII_PageID'] : '', 'ControllerName' => $isPage ? $this->getControllerNameByID($row['MII_PageID']) : '', 'MenuTitleStyle' => $row['MID_Style']); } else { $tmp = array('MenuTitle' => '', 'MenuLink' => '', 'menuItemSecured' => '', 'menuImage' => '', 'loadImage' => '', 'menuImgAndTitle' => '', 'MenuType' => 'external', 'pagePicker' => '', 'ControllerName' => '', 'MenuTitleStyle' => ''); } return $tmp; }
function ReportAssignment(&$tpl, &$members, &$papers, &$choice, $db) { // get the config from the registry $registry = Zend_registry::getInstance(); $config = $registry->get("Config"); $config->putInView($tpl); $tpl->set_var("MAXIMAL_WEIGHT", $config['nbReviewersPerItem'] * 4); $tpl->set_var("SESSION_ID", session_id()); // This function might potentially reach the memory // limit of PHP. Check that this does not happen if (function_exists("memory_get_usage")) { // The following instruction can raise the memory limit ini_set("memory_limit", "100M"); ini_set("max_execution_time", "300"); // 5 mns } // Header of the array reset($members); $userTbl = new User(); foreach ($members as $id) { $user = $userTbl->find($id)->current(); $user->putInView($tpl); $tpl->append("MEMBERS", "MEMBER_DETAIL"); } // Display the array reset($papers); while (list($iPaper, $idPaper) = each($papers)) { $weightPaper = 0; reset($members); while (list($iRef, $email) = each($members)) { $paper = GetPaper($idPaper, $db, "object"); InstanciatePaperVars($paper, $tpl, $db); if ($choice[$iRef][$iPaper] != 0) { $tpl->set_var("BG_COLOR", "lightblue"); $tpl->set_var("PAPER_RATING", $choice[$iRef][$iPaper]); $weightPaper += $choice[$iRef][$iPaper]; } else { $tpl->set_var("BG_COLOR", "white"); $tpl->set_var("PAPER_RATING", GetRatingValue($papers[$iPaper], $members[$iRef], $db)); } $tpl->set_var("WEIGHT", "{$weightPaper}"); $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL"); } // Add to the list of papers $tpl->append("PAPERS", "PAPER_DETAIL"); $tpl->set_var("ASSIGNMENTS", ""); } }
function SummaryPapersAssignment(&$tpl, $db, &$TEXTS) { $registry = Zend_registry::getInstance(); $config = $registry->get("Config"); $config->putInView($tpl); $db = Zend_Db_Table::getDefaultAdapter(); $paperTbl = new Paper(); $reviewTbl = new Review(); $ratingTbl = new Rating(); $userTbl = new User(); /* Check whether there is a prefered topic for papers */ if ($config->selectedPaperTopic) { $prefPaperTopic = $config->selectedPaperTopic; } else { $prefPaperTopic = "%"; } /* Check whether there is a prefered topic for reviewers */ if ($config->selectedReviewerTopic) { $prefReviewerTopic = $config->selectedReviewerTopic; } else { $prefReviewerTopic = "%"; } // Decompose the blocks of the template $tpl->set_block("content", "MEMBER_DETAIL", "MEMBERS"); $tpl->set_block("content", "PAPER_DETAIL", "PAPERS"); $tpl->set_block("content", "NAVIGATION_TABLE", "NAVIGATION"); $tpl->set_block("PAPER_DETAIL", "ASSIGNMENT_DETAIL", "ASSIGNMENTS"); // Get the list of topics $topicList = $db->fetchPairs("SELECT id, label FROM ResearchTopic"); $topicList["0"] = "Any"; ksort($topicList); // Show the selection list $tpl->paper_topics = Zmax_View_Phplib::selectField("paperTopic", $topicList, $prefPaperTopic); $tpl->reviewer_topics = Zmax_View_Phplib::selectField("reviewerTopic", $topicList, $prefReviewerTopic); /* Store the list of reviewers in an array (+easier, +efficient). */ $members = array(); $nb_members = 0; $users = $userTbl->fetchAll("roles LIKE '%R%'", "last_name"); foreach ($users as $user) { if ($prefReviewerTopic == '%' or $user->matchTopic($prefReviewerTopic)) { $members[++$nb_members] = $user; } } // Same thing for papers $papers = array(); $nb_papers = 0; $rPapers = $db->query("SELECT * FROM Paper ORDER BY id"); while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) { if ($prefPaperTopic == '%' or $paper->topic == $prefPaperTopic) { $papers[++$nb_papers] = $paper; } } // Manage the navigation table if ($nb_papers > MAX_ITEMS_IN_ASSIGNMENT or $nb_members > MAX_ITEMS_IN_ASSIGNMENT) { // Show the navigation table $tpl->set_var("nb_paper", $nb_papers); $tpl->set_var("nb_reviewers", $nb_members); $tpl->set_var("max_items_in_assignment", MAX_ITEMS_IN_ASSIGNMENT); if (isset($_REQUEST['i_paper_min'])) { // The request comes from the navigation table $i_paper_min = $_REQUEST['i_paper_min']; $i_paper_max = min($_REQUEST['i_paper_max'], $nb_papers); $i_member_min = $_REQUEST['i_member_min']; $i_member_max = min($_REQUEST['i_member_max'], $nb_members); } else { $i_paper_min = 1; $i_paper_max = min($nb_papers, MAX_ITEMS_IN_ASSIGNMENT); $i_member_min = 1; $i_member_max = min($nb_members, MAX_ITEMS_IN_ASSIGNMENT); } // Show the navigation table $tpl->set_var("NAV_TABLE", ""); $lines = ""; $script = $tpl->base_url . "/admin/chair/showassignment?1=1"; for ($i = 1; $i <= $nb_papers; $i += MAX_ITEMS_IN_ASSIGNMENT) { $line = ""; for ($j = 1; $j <= $nb_members; $j += MAX_ITEMS_IN_ASSIGNMENT) { $link = $script . "&i_paper_min={$i}" . "&i_paper_max=" . ($i + MAX_ITEMS_IN_ASSIGNMENT - 1) . "&i_member_min={$j}" . "&i_member_max=" . ($j + MAX_ITEMS_IN_ASSIGNMENT - 1); if ($i == $i_paper_min and $j == $i_member_min) { $line .= "<td bgcolor=lightblue><a href='{$link}'>" . "<font color=white>{$i}/{$j}</font></a></td>"; } else { $line .= "<td><a href='{$link}'>{$i}/{$j}</a></td>"; } } $lines .= "<tr>{$line}</tr>\n"; } $tpl->set_var("NAV_TABLE", $lines); $tpl->append("NAVIGATION", "NAVIGATION_TABLE"); } else { // Hide the navigation table $i_paper_min = $i_member_min = 1; $i_paper_max = $nb_papers; $i_member_max = $nb_members; $tpl->set_var("NAVIGATION", ""); } // Put the current values in the template $tpl->set_var("I_PAPER_MIN", $i_paper_min); $tpl->set_var("I_PAPER_MAX", $i_paper_max); $tpl->set_var("I_MEMBER_MIN", $i_member_min); $tpl->set_var("I_MEMBER_MAX", $i_member_max); // echo "I paper min=$i_paper_min I paper max = $i_paper_max<br>"; // OK, now create the table. First the columns' headers for ($j = $i_member_min; $j <= $i_member_max; $j++) { $members[$j]->putInView($tpl); $tpl->member_nb_papers = $members[$j]->countPapers(); $tpl->append("MEMBERS", "MEMBER_DETAIL"); } // then each line $tpl->PAPERS = ""; for ($i = $i_paper_min; $i <= $i_paper_max; $i++) { // Choose the CSS class if ($i % 2 == 0) { $tpl->set_var("css_class", "even"); } else { $tpl->set_var("css_class", "odd"); } $paper = $papers[$i]; $entity = "Paper" . "->id"; $tpl->setVar($entity, $papers[$i]->id); $tpl->SESSION_ID = session_id(); // Get the ratings of each PC member $nbReviewers = 0; for ($j = $i_member_min; $j <= $i_member_max; $j++) { $member = $members[$j]; $member->putInView($tpl); $rating = $ratingTbl->find($paper->id, $member->id)->current(); if ($rating) { $val = $rating->rate; } else { $val = 2; } $tpl->bg_color = "white"; $tpl->set_var("paper_rating", $val); $tpl->set_var("CHECKED_YES", ""); $tpl->set_var("CHECKED_NO", "checked='1'"); // Check if the paper is assigned $review = $reviewTbl->find($paper->id, $member->id)->current(); if ($review) { $nbReviewers = $nbReviewers + 1; $tpl->bg_color = "yellow"; $tpl->set_var("CHECKED_YES", "checked='1'"); $tpl->set_var("CHECKED_NO", ""); } // Add to the assignment line $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL"); } // Add to the list of papers $tpl->setVar("paper_nb_reviewers", $nbReviewers); $tpl->append("PAPERS", "PAPER_DETAIL"); $tpl->set_var("ASSIGNMENTS", ""); } }
/** * Get the list of authors */ function getAuthors($format = "string") { // We first look at the blind review mode $registry = Zend_registry::getInstance(); $zmax_context = $registry->get("zmax_context"); // If blind -> return the anonymous string, except if the user is admin if ($this->hideAuthors()) { return $zmax_context->texts->anonymous_author; } else { // Create a string with list of authors $strAuthors = $comma = ""; foreach ($this->_authors as $author) { $strAuthors .= $comma . $author->first_name . " " . $author->last_name; $comma = ", "; } return $strAuthors; } }
/** * Edit method: used to manage a simple workflow for editing * @param object the request object * @return none */ public function edit($request) { // Extract the controller and action info. $module = $request->getModuleName(); $control = $request->getControllerName(); $action = $request->getActionName(); // Set the current edit action URL (use the config to obtain the base URL) // Get the utilitary objects from the registry $registry = Zend_registry::getInstance(); $zmax_context = $registry->get("zmax_context"); if ($module == "default") { $this->url = $zmax_context->config->app->base_url . "/" . $control . "/" . $action . "?1=1"; } else { $this->url = $zmax_context->config->app->base_url . "/" . $module . "/" . $control . "/" . $action . "?1=1"; } // echo "Control = $control Action = $action URL=$this->url<br/>"; // Get the values of the table form if ($request->getParam("show_table_form")) { // Get the values submitted in the table form foreach ($this->info['cols'] as $name) { $form_field_name = $this->getTblFormFieldName($name); if ($request->getParam($form_field_name)) { $this->table_form_values[$form_field_name] = $request->getParam($form_field_name); // Put these values in a GET query $this->form_table_query .= "&{$form_field_name}=" . urlEncode($request->getParam($form_field_name)); } } // echo "Table form fields:"; // print_r ($this->table_form_values); $this->form_table_query = "&show_table_form=1" . $this->form_table_query; } // We are only interested in POST parameters $paramsHTTP = $_REQUEST; // PR: do better // Check whether an action is required. if (isset($paramsHTTP[self::ZMAX_EDIT_ACTION])) { $action = $paramsHTTP[self::ZMAX_EDIT_ACTION]; } else { $action = ""; } $affichage = ""; switch ($action) { case self::DB_INSERT: // Insertion required if ($this->insertion($paramsHTTP)) { $affichage .= "<i>Insertion: done</i>"; $affichage .= "<h2>Input form</h2>"; $affichage .= $this->form(self::DB_INSERT, array()); } else { $affichage .= $this->messageList(); $affichage .= $this->form(self::DB_INSERT, $paramsHTTP); } break; case self::DB_UPDATE: // We must modify the row if ($this->update($paramsHTTP)) { $affichage .= "<i>Update: done.</i>"; } else { $affichage .= $this->messageList(); } $ligne = $this->getRow($paramsHTTP); $affichage .= $this->form(self::DB_UPDATE, $ligne); break; case self::DB_DELETE: // Remove the line $this->delete($paramsHTTP); $affichage .= "<i>Deletion: done.</i>"; $affichage .= $this->form(self::DB_INSERT, array()); break; case self::DB_EDIT: // Search a row and edit it $ligne = $this->getRow($paramsHTTP); $affichage .= $this->form(self::DB_UPDATE, $ligne); break; default: $affichage .= $this->form(self::DB_INSERT, array()); break; } $affichage .= "<br />\n"; // petite separation // Maybe show the HTML table with the content of the table if ($this->show_table_content) { $affichage .= "<h2><i>{$this->table_label}</i></h2>\n"; $affichage .= $this->table(array("BORDER" => 2)); } // Maybe show the form if ($this->mode_show_form) { $add_url = $this->url . $this->form_table_query; $affichage .= "<a href='{$add_url}'>{$this->texts->form->add_line}</a>\n"; } // Retour de la page HTML return $affichage; }
/** * List of papers with their reviews */ private function papersReviews($view, $templateName, $html = true, $anonymized = false) { $db = Zend_Db_Table::getDefaultAdapter(); $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); $criteriaTbl = new Criteria(); $reviewTbl = new Review(); $reviewMarkTbl = new ReviewMark(); $registry = Zend_registry::getInstance(); $config = $registry->get("Config"); $config->putInView($view); // Set the mail types $view->someUser = Mail::SOME_USER; // Extract the block for each paper $view->setBlock($templateName, "PAPER_DETAIL", "PAPERS"); $view->setBlock($templateName, "REVIEW_CRITERIA", "REVIEW_CRITERIAS"); $view->setBlock("PAPER_DETAIL", "PAPER_INFO", "PAPER_DATA"); $view->setBlock("PAPER_DETAIL", "REVIEW_MARK", "REVIEW_MARKS"); $view->setBlock("PAPER_DETAIL", "REVIEWER", "REVIEWER_INFO"); // Header of the table, taken from table Criteria $criterias = $criteriaTbl->fetchAll(); $listCriterias = array(); foreach ($criterias as $criteria) { $criteria->putInView($view); $listCriterias[] = $criteria; $view->append("REVIEW_CRITERIAS", "REVIEW_CRITERIA"); } // Sort the papers on the average 'overall' field $query = "SELECT p.*, round(AVG(overall),4) AS overall " . "FROM Paper p LEFT JOIN Review r ON p.id=r.idPaper " . " WHERE inCurrentSelection='Y' GROUP BY p.id"; $result = $db->query($query); $arrPaper = $rankPaper = array(); while ($paper = $result->fetch(Zend_Db::FETCH_OBJ)) { $arrPaper[$paper->id] = $paper; $rankPaper[$paper->id] = $paper->overall; } // Get the status list $statusList = $db->fetchPairs("SELECT * FROM PaperStatus WHERE final_status='Y'"); // Sort in descending order arsort($rankPaper); reset($rankPaper); // List the papers in order $iPaper = 0; foreach ($rankPaper as $idPaper => $overall) { $paper = $arrPaper[$idPaper]; // Choose the CSS class $view->css_class = Config::CssCLass($iPaper++); $view->paper_id = $paper->id; $view->paper_title = $paper->title; if (!$anonymized) { $view->paper_authors = PaperRow::getPaperAuthors($db, $paper); } else { $view->paper_authors = "[anonymized]"; } $view->paper_email_contact = $paper->emailContact; $view->paper_rank = $iPaper; $view->paper_overall = $overall; $view->form_status = Zmax_View_Phplib::checkboxField("radio", "status[{$paper->id}]", $statusList, $paper->status, array("length" => 2)); // Now, loop on reviews $qRev = "SELECT * FROM Review r, User u " . " WHERE idPaper='{$paper->id}' AND u.id=r.id_user"; $resRev = $db->query($qRev); $countReviews = 0; $mail_reviewers = $comma = ""; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $countReviews++; $mail_reviewers .= $comma . $review->email; $comma = ", "; } $view->paper_nb_reviewers = Max(1, $countReviews); //echo "Mail reviewers = $mail_reviewers<br/>"; $view->paper_email_reviewers = $mail_reviewers; $view->append("PAPER_DATA", "PAPER_INFO"); $resRev = $db->query($qRev); $iReview = 0; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $iReview++; $view->reviewer_id = $review->id; if ($anonymized == false) { $view->reviewer_fname = $review->first_name; $view->reviewer_lname = $review->last_name; $view->external_reviewer_fname = $review->fname_ext_reviewer; $view->external_reviewer_lname = $review->lname_ext_reviewer; $view->review_comments = $review->comments; } else { $view->reviewer_fname = $iReview; $view->reviewer_lname = ""; $view->external_reviewer_fname = ""; $view->external_reviewer_lname = ""; $view->review_comments = ""; } $view->reviewer_email = $review->email; $view->review_overall = $review->overall; $view->review_summary = $review->summary; $view->review_details = $review->details; if ($review->reviewerExpertise >= 1 and $review->reviewerExpertise <= 3) { $view->reviewer_expertise = Config::$Expertise[$review->reviewerExpertise]; } // Avoid to introduce Latex commands in Latex files .... if (!$html) { $view->review_summary = str_replace("\\", "", $view->review_summary); $view->review_details = str_replace("\\", "", $view->review_details); $view->review_comments = str_replace("\\", "", $view->review_comments); } $view->assign("REVIEWER_INFO", "REVIEWER"); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $criteria) { $reviewMark = $reviewMarkTbl->find($review->idPaper, $review->id_user, $criteria->id)->current(); if (!is_object($reviewMark)) { $reviewMark = $reviewMarkTbl->createRow(); // for default values } $reviewMark->putInView($view); $view->criteria_label = $criteria->label; $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); // The paper data is shown only once for all the reviews $view->set_var("PAPER_DATA", " "); } // Show the paper even without reviewer if ($countReviews == 0) { $review = $reviewTbl->createRow(); $review->putInView($view); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $id => $label) { $reviewMark = $reviewMarkTbl->createRow(); $reviewMark->putInView($view); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->set_var("REVIEWER_INFO", ""); $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } // Summary for the paper if ($html) { $statPaper = Paper::getStats($paper->id, $listCriterias); $markFieldName = "ReviewMark" . "->mark"; $overallFieldName = "review_overall"; $view->set_var("NB_REVIEWERS", 1); if ($html) { $view->set_var("PAPER_DATA", "<td> </td><th>Summary</th>"); } $view->set_var("REVIEWER_INFO", " "); $view->set_var($overallFieldName, $paper->overall); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $c) { $view->setVar($markFieldName, $statPaper[$c->id]); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } } }
public function subscribeAction() { if (isset($_POST['gift_id']) && isset($_POST['email'])) { $_POST['gift_id'] = (int) $_POST['gift_id']; $_POST['email'] = Zend_registry::get('target')->db->escape($_POST['email']); $_POST['user_name'] = !empty($_POST['user_name']) ? Zend_registry::get('target')->db->escape($_POST['user_name']) : ''; $gift = new gift($_POST['gift_id']); if ($gift->get('id') && !empty($_POST["email"])) { $waiting_gifts = new p_waiting_gifts(); //Отправляем письмо юзеру $et = new email_template('subscribe_user'); $et->assign('USER_NAME', !empty($_POST["user_name"]) ? ", {$_POST["user_name"]}" : '')->assign('GIFT_NAME', $gift->get('display_name'))->assign('URL_GIFT', "http://{$_SERVER['SERVER_NAME']}/" . $gift->get('local_url') . '/?utm_source=email&utm_medium=user&utm_campaign=subscribe_user')->send($_POST["email"], $_POST["user_name"])->send('*****@*****.**'); $waiting_gifts->subscribe($gift->get('id'), $_POST['email'], $_POST['user_name']); } } die; }
public function getFiltrada($campo, $valor) { $db = Zend_registry::get('db'); $tab = $campo == 'nome' ? 'c' : 't'; $select = $db->select()->from(array('o' => 'operadoras'), array('nome'))->from(array('t' => 'tarifas'))->join(array('tv' => 'tarifas_valores'), 't.codigo = tv.codigo AND o.codigo = t.operadora'); if (!is_null($valor)) { //$select->where(" $tab.". $campo ." like '%". $valor ."%'"); } $stmt = $db->query($select); $arrFiltro = $stmt->fetchAll(); return $arrFiltro; }
if (isset($opts->app_env)) { defined('APPLICATION_ENV') || define('APPLICATION_ENV', $opts->app_env); } else { echo "\n\nParametr app_env jest wymagany!"; echo "\n\n" . $opts->getUsageMessage() . "\n\n"; exit; } /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true; $application->bootstrap(); $application->getBootstrap()->runForCmd(); Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap()); Zend_registry::set('config', $application->getOptions()); $user = $application->getOption('bin'); $u = new User(); $u_data = $u->fetchAll("login = '******'user'] . "'", "id DESC", 1); if (null == $u_data) { throw new Exception('Brak użytkownika o podanym ID'); } $u_data = $u_data->toArray(); $storageRow = new stdClass(); foreach ($u_data[0] as $key => $value) { $storageRow->{$key} = $value; } $auth = Zend_Auth::getInstance(); $storage = $auth->getStorage(); $o = new Branch(); $data = $o->fetchAll("branch_name = '" . $user['branch'] . "'", "id DESC", 1)->toArray();