function newlookup_POST(Web &$w) { $w->Admin->navigation($w, "Lookup"); $_REQUEST['type'] = $_REQUEST['ntype'] != "" ? $_REQUEST['ntype'] : $_REQUEST['type']; $err = ""; if ($_REQUEST['type'] == "") { $err = "Please add select or create a TYPE<br>"; } if ($_REQUEST['code'] == "") { $err .= "Please enter a KEY<br>"; } if ($_REQUEST['title'] == "") { $err .= "Please enter a VALUE<br>"; } if ($w->Admin->getLookupbyTypeCode($_REQUEST['type'], $_REQUEST['code'])) { $err .= "Type and Key combination already exists"; } if ($err != "") { $w->error($err, "/admin/lookup/?tab=2"); } else { $lookup = new Lookup($w); $lookup->fill($_REQUEST); $lookup->insert(); $w->msg("Lookup Item added", "/admin/lookup/"); } }
/** * @return array validation rules for model attributes. */ public function rules() { return (Y::checkAccess('moderator')?array( array('username, password, email', 'required', 'on' => 'create'), array('username, email', 'required', 'on' => 'update'), array('id, role, username, password, email, activkey, createtime, lastvisit, status', 'safe'), array('username', 'length', 'max'=>20, 'min' => 3,'message' => Users::t("Incorrect username (length between 2 and 20 characters).")), array('password', 'length', 'max'=>128, 'min' => 4,'message' => Users::t("Incorrect password (minimal length 4 symbols).")), array('email', 'email'), array('username', 'unique', 'message' => Users::t("This user's name already exists.")), array('email', 'unique', 'message' => Users::t("This user's email address already exists.")), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => Users::t("Incorrect symbols (A-z0-9).")), array('status', 'in', 'range'=>array(self::STATUS_NOACTIVE,self::STATUS_ACTIVE,self::STATUS_BANED)), array('role', 'in', 'range'=>Lookup::keys('role')), array('username, email, createtime, lastvisit, status', 'required'), array('createtime, lastvisit, status', 'numerical', 'integerOnly'=>true), ):((Y::userId()==$this->id)?array( array('username, email', 'required'), array('username', 'length', 'max'=>20, 'min' => 3,'message' => Users::t("Incorrect username (length between 2 and 20 characters).")), array('email', 'email'), array('username', 'unique', 'message' => Users::t("This user's name already exists.")), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => Users::t("Incorrect symbols (A-z0-9).")), array('email', 'unique', 'message' => Users::t("This user's email address already exists.")), ):array())); }
public function actionEditBlog($id) { $model = new Post(); $rec = Post::model()->findByPk($id); $r = Lookup::model()->findAll(array('condition' => 'type=:t', 'params' => array(':t' => 'PostStatus'))); //echo "<pre>";print_r($r);die; foreach ($r as $type) { //echo "<pre>";print_r($type); $i[] = $type->id; $n[] = $type->name; $op = array_combine($i, $n); } //die; //echo "<pre>";print_r($rec);die; if (isset($_POST['Post'])) { $model->attributes = $_POST['Post']; if ($model->validate()) { $res = Post::model()->findByPk($id); $res->title = $_REQUEST['Post']['title']; $res->content = $_REQUEST['Post']['content']; $res->tags = $_REQUEST['Post']['tags']; $res->status = $_REQUEST['Post']['status']; $res->update_time = date('Y-m-d'); if ($res->save(false)) { $this->redirect(array('postlisting')); } } else { $errors = $model->getErrors(); } } $this->render('editblog', array('edit' => $rec, 'model' => $model, 'type' => $op, 'i' => $i)); }
function settings_meta_box($Customer) { ?> <p> <span> <input type="hidden" name="marketing" value="no" /> <input type="checkbox" id="marketing" name="marketing" value="yes"<?php echo $Customer->marketing == 'yes' ? ' checked="checked"' : ''; ?> /> <label for="marketing" class="inline"> <?php _e('Subscribes to marketing', 'Shopp'); ?> </label> </span> </p> <br class="clear" /> <p> <span> <select name="type"><?php echo Shopp::menuoptions(Lookup::customer_types(), $Customer->type); ?> </select> <label for="type"><?php _e('Customer Type', 'Shopp'); ?> </label> </span> </p> <br class="clear" /> <?php do_action('shopp_customer_editor_settings', $Customer); }
static function country($data) { $countries = Lookup::countries(); if (isset($countries[$data->country])) { return $countries[$data->country]['name']; } return $data->country; }
public function testItems() { $items = Lookup::items('CrashReportStatus'); $this->assertTrue($items[1] == 'Waiting'); Lookup::reset(); $items = Lookup::items('BugStatus', Bug::STATUS_OPEN_MAX); $this->assertTrue($items[1] == 'New'); $this->assertTrue(count($items) == 4); }
public function saveLookup($key) { try { $lookup = $this->find('content=:content', array(':content' => $key)); if (isset($lookup) && !is_null($lookup)) { $lookup->search_count = $lookup->search_count + 1; $lookup->last_search_date = new CDbExpression('NOW()'); $lookup->save(); } else { $lookup = new Lookup(); $lookup->search_count = 1; $lookup->last_search_date = new CDbExpression('NOW()'); $lookup->content = $key; $lookup->keyword_order = 1; $lookup->save(); } } catch (Exception $e) { } }
function actionSearch() { header('Content-type: application/json'); // if(Yii::app()->user->isGuest){ // IjoyPlusServiceUtils::exportServiceError(Constants::SEESION_IS_EXPIRED); // return ; // } if (!IjoyPlusServiceUtils::validateAPPKey()) { IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID); return; } $keyword = Yii::app()->request->getParam("keyword"); if (!(isset($keyword) && !is_null($keyword) && strlen($keyword) > 0)) { IjoyPlusServiceUtils::exportServiceError(Constants::KEYWORD_IS_NULL); return; } $keyword = trim($keyword); Lookup::model()->saveLookup($keyword); if (!FilterUtils::keyWordValid($keyword)) { IjoyPlusServiceUtils::exportEntity(array('results' => array())); return; } // $keyword= iconv("GBK","UTF-8",$keyword);n // var_dump($keyword); //$keyword='???'; // var_dump($keyword); $keyword = strtr($keyword, array('%' => '\\%', '_' => '\\_')); // var_dump($keyword); $page_size = Yii::app()->request->getParam("page_size"); $page_num = Yii::app()->request->getParam("page_num"); if (!(isset($page_size) && is_numeric($page_size))) { $page_size = 10; $page_num = 1; } else { if (!(isset($page_num) && is_numeric($page_num))) { $page_num = 1; } } $type = Yii::app()->request->getParam("type"); try { if (is_null($type) || $type == '') { $prods = SearchManager::searchProgram($keyword, $page_size, $page_size * ($page_num - 1)); } else { $prods = SearchManager::searchProgramByType($keyword, $type, $page_size, $page_size * ($page_num - 1)); } if (isset($prods) && is_array($prods)) { IjoyPlusServiceUtils::exportEntity(array('results' => $prods)); } else { IjoyPlusServiceUtils::exportEntity(array('results' => array())); } } catch (Exception $e) { var_dump($e); IjoyPlusServiceUtils::exportServiceError(Constants::SYSTEM_ERROR); } }
public function screen() { $Shopp = Shopp::object(); if (!current_user_can('shopp_settings_checkout')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table); $next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1"); $next_setting = shopp_setting('next_order_id'); if ($next->id > $next_setting) { $next_setting = $next->id; } $term_recount = false; if (!empty($_POST['save'])) { check_admin_referer('shopp-setup-management'); $next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']); if ($next_order_id >= $next->id) { if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) { $next_setting = $next_order_id; } } $_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']); // Recount terms when this setting changes if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) { $term_recount = true; } shopp_set_formsettings(); $this->notice(Shopp::__('Management settings saved.'), 'notice', 20); } if ($term_recount) { $taxonomy = ProductCategory::$taxon; $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids')); if (!empty($terms)) { wp_update_term_count_now($terms, $taxonomy); } } $states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels())); $statusLabels = shopp_setting('order_status'); $statesLabels = shopp_setting('order_states'); $reasonLabels = shopp_setting('cancel_reasons'); if (empty($reasonLabels)) { $reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp')); } $promolimit = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20', '25'); $lowstock = shopp_setting('lowstock_level'); if (empty($lowstock)) { $lowstock = 0; } include $this->ui('management.php'); }
public function actionAvatars() { $this->layout = '//layouts/blank'; $dataProvider = null; if (isset($_GET['uid'])) { $id = $_GET['uid']; $type = $_GET['type'] ? $_GET['type'] : Lookup::USER_PIC_FOLDER; $lookup = Lookup::model()->find(array('condition' => 'uid = :uid AND type = :type', 'params' => array(':uid' => $id, ':type' => $type))); if ($lookup !== null) { $pid = $lookup->id; $criteria = new CDbCriteria(array('condition' => 'pid = :pid AND uid = :uid', 'order' => 'id DESC', 'params' => array(':pid' => $pid, ':uid' => $id))); $count = File::model()->count($criteria); $pages = new CPagination($count); // results per page $pages->pageSize = 14; $pages->applyLimit($criteria); $dataProvider = new CActiveDataProvider('File', array('criteria' => $criteria, 'pagination' => $pages)); } } $this->render('avatars', array('dataProvider' => $dataProvider)); }
/** * Manages all models. */ public function actionAdmin() { $all = Lookup::model()->getAll(); Y::dump($all); $model = new Portfolio('search'); $model->unsetAttributes(); // clear any default values $model = $model->current($cat); if (isset($_GET['Portfolio'])) $model->attributes=$_GET['Portfolio']; if (isset($_GET['ajax'])) { $this->renderPartial('admingrid',array( 'model'=>$model, )); } else { $this->render('admin',array( 'model'=>$model, 'cat'=>$cat )); } }
'value' => 'CHtml::link(CHtml::encode($data->username),Users::url("admin/view",array("id"=>$data->id)))', ), array( 'name'=>'email', 'type'=>'raw', 'value'=>'CHtml::link(CHtml::encode($data->email), "mailto:".$data->email)', ), array( 'name'=>'status', 'value'=>'User::itemAlias("UserStatus",$data->status)', 'filter'=>User::aliases('UserStatus'), ), array( 'name'=>'role', 'type'=>'raw', 'value'=>'Lookup::item("role",$data->role)', 'filter'=>Lookup::items('role'), ), array( 'name' => 'createtime', 'value' => 'date("d.m.Y H:i:s",$data->createtime)', ), array( 'name' => 'lastvisit', 'value' => '($data->lastvisit?date("d.m.Y H:i:s",$data->lastvisit):Users::t("Not visited"))', ), array( 'class'=>'CButtonColumn', ), ), )); ?>
/** * Renders the recent orders dashboard widget * * @author Jonathan Davis * @since 1.0 * * @return void **/ public static function orders_widget($args = false) { $defaults = array('before_widget' => '', 'before_title' => '', 'widget_name' => '', 'after_title' => '', 'after_widget' => ''); $args = array_merge($defaults, (array) $args); extract($args, EXTR_SKIP); $statusLabels = shopp_setting('order_status'); echo $before_widget; echo $before_title; echo $widget_name; echo $after_title; $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table); $purchasedtable = ShoppDatabaseObject::tablename(Purchased::$table); $txnlabels = Lookup::txnstatus_labels(); if (!($Orders = get_transient('shopp_dashboard_orders'))) { $Orders = sDB::query("SELECT p.*,count(*) as items FROM (SELECT * FROM {$purchasetable} WHERE txnstatus != 'purchased' AND txnstatus != 'invoiced' ORDER BY created DESC LIMIT 6) AS p LEFT JOIN {$purchasedtable} AS i ON i.purchase=p.id GROUP BY p.id ORDER BY p.id DESC", 'array'); set_transient('shopp_dashboard_orders', $Orders, 90); // Keep for the next 1 minute } if (!empty($Orders)) { echo '<table class="widefat">' . '<thead>' . ' <tr>' . ' <th scope="col">' . __('Name', 'Shopp') . '</th>' . ' <th scope="col">' . __('Date', 'Shopp') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Items') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Total') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Status') . '</th>' . ' </tr>' . '</thead>' . ' <tbody id="orders" class="list orders">'; $even = false; foreach ($Orders as $Order) { $classes = array(); if ($even = !$even) { $classes[] = 'alternate'; } $txnstatus = isset($txnlabels[$Order->txnstatus]) ? $txnlabels[$Order->txnstatus] : $Order->txnstatus; $status = isset($statusLabels[$Order->status]) ? $statusLabels[$Order->status] : $Order->status; $contact = '' == $Order->firstname . $Order->lastname ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname; $url = add_query_arg(array('page' => ShoppAdmin()->pagename('orders'), 'id' => $Order->id), admin_url('admin.php')); $classes[] = strtolower(preg_replace('/[^\\w]/', '_', $Order->txnstatus)); echo '<tr class="' . join(' ', $classes) . '">' . ' <td><a class="row-title" href="' . $url . '" title="View "Order ' . $Order->id . '"">' . (empty($Order->firstname) && empty($Order->lastname) ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname) . '</a></td>' . ' <td>' . date("Y/m/d", mktimestamp($Order->created)) . '</td>' . ' <td class="num items">' . $Order->items . '</td>' . ' <td class="num total">' . money($Order->total) . '</td>' . ' <td class="num status">' . $statusLabels[$Order->status] . '</td>' . '</tr>'; } echo '</tbody></table>'; } else { echo '<p>' . Shopp::__('No orders, yet.') . '</p>'; } echo $after_widget; }
/** * Queues Shopp storefront javascript and styles as needed * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function behaviors() { $Shopp = Shopp::object(); if (is_ssl()) { $urls = array('option_siteurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src'); foreach ($urls as $filter) { add_filter($filter, 'force_ssl'); } } // Replace the WordPress canonical link remove_action('wp_head', 'rel_canonical'); add_action('wp_head', array($this, 'header')); add_action('wp_footer', array($this, 'footer')); wp_enqueue_style('shopp.catalog', SHOPP_ADMIN_URI . '/styles/catalog.css', array(), 20110511, 'screen'); wp_enqueue_style('shopp.icons', SHOPP_ADMIN_URI . '/styles/icons.css', array(), 20110511, 'screen'); wp_enqueue_style('shopp', Shopp::template_url('shopp.css'), array(), 20110511, 'screen'); wp_enqueue_style('shopp.colorbox', SHOPP_ADMIN_URI . '/styles/colorbox.css', array(), 20110511, 'screen'); $orderhistory = is_account_page() && isset($_GET['id']) && !empty($_GET['id']); if (is_thanks_page() || $orderhistory) { wp_enqueue_style('shopp.printable', SHOPP_ADMIN_URI . '/styles/printable.css', array(), 20110511, 'print'); } $loading = shopp_setting('script_loading'); if (!$loading || 'global' == $loading || !empty($page)) { shopp_enqueue_script('colorbox'); shopp_enqueue_script('shopp'); shopp_enqueue_script('catalog'); shopp_enqueue_script('cart'); if (is_catalog_page()) { shopp_custom_script('catalog', "var pricetags = {};\n"); } } if (is_checkout_page()) { shopp_enqueue_script('address'); shopp_enqueue_script('checkout'); } if (is_confirm_page()) { shopp_enqueue_script('checkout'); } if (is_account_page()) { shopp_enqueue_script('address'); $regions = Lookup::country_zones(); $js = 'var regions=' . json_encode($regions); add_storefrontjs($js, true); } }
/** * Helper method to render markup for state/province input fields * * @internal * @since 1.3 * * @param string $result The output * @param array $options The options * - **mode**: `input` (input, value) Displays the field `input` or the current value of the property * - **type**: `menu` (menu, text) Changes the input type to a drop-down menu or text input field * - **options**: A comma-separated list of options for the drop-down menu when the **type** is set to `menu` * - **required**: `auto` (auto,on,off) Sets the field to be required automatically, always `on` or disabled `off` * - **class**: The class attribute specifies one or more class-names for the input * - **label**: The label shown as the default option of the drop-down menu when the **type** is set to `menu` * - **address**: `billing` (billing,shipping) Used to specify which address the field takes input for * @param ShoppCustomer $O The working object * @return string The state input markup **/ private static function state($result, $options, $O) { $defaults = array('mode' => 'input', 'type' => 'menu', 'options' => '', 'required' => 'auto', 'class' => '', 'label' => '', 'address' => 'billing'); $options = array_merge($defaults, $options); $options['address'] = self::valid_address($options['address']); $Address = self::AddressObject($options['address']); if (!isset($options['value'])) { $options['value'] = $Address->state; } $options['selected'] = $options['value']; $options['id'] = "{$options['address']}-state"; extract($options, EXTR_SKIP); if ('value' == $mode) { return $value; } $countries = (array) shopp_setting('target_markets'); $select_attrs = array('title', 'required', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey'); $country = ShoppBaseLocale()->country(); if (!empty($Address->country)) { $country = $Address->country; } if (!array_key_exists($country, $countries)) { $country = key($countries); } $regions = Lookup::country_zones(); $states = isset($regions[$country]) ? $regions[$country] : array(); if (!empty($options['options']) && empty($states)) { $states = explode(',', $options['options']); } $classes = false === strpos($class, ' ') ? explode(' ', $class) : array(); $classes[] = $id; if ('auto' == $required) { unset($options['required']); // prevent inputattrs from handling required=auto $classes[] = 'auto-required'; } $options['class'] = join(' ', $classes); if ('text' == $type) { return '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>'; } $options['disabled'] = 'disabled'; $options['class'] = join(' ', array_merge($classes, array('disabled', 'hidden'))); $result = '<select name="' . $address . '[state]" id="' . $id . '-menu" ' . inputattrs($options, $select_attrs) . '>' . '<option value="">' . $label . '</option>' . (!empty($states) ? menuoptions($states, $selected, true) : '') . '</select>'; unset($options['disabled']); $options['class'] = join(' ', $classes); $result .= '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>'; return $result; }
/** * Provides ecart('checkout') template API functionality * * @since 1.0 * * @return mixed **/ function tag ($property,$options=array()) { global $Ecart,$wp; $pages = $Ecart->Settings->get('pages'); $base = $Ecart->Settings->get('base_operations'); $countries = $Ecart->Settings->get('target_markets'); $process = get_query_var('ecart_proc'); $select_attrs = array('title','required','class','disabled','required','size','tabindex','accesskey'); $submit_attrs = array('title','class','value','disabled','tabindex','accesskey'); if (!isset($options['mode'])) $options['mode'] = "input"; switch ($property) { case "url": $link = ecarturl(false,'checkout',$this->security()); // Pass any arguments along $args = $_GET; unset($args['page_id'],$args['acct']); $link = esc_url(add_query_arg($args,$link)); if ($process == "confirm-order") $link = apply_filters('ecart_confirm_url',$link); else $link = apply_filters('ecart_checkout_url',$link); return $link; break; case "function": if (!isset($options['shipcalc'])) $options['shipcalc'] = '<img src="'.ECART_ADMIN_URI.'/icons/updating.gif" alt="'.__('Updating','Ecart').'" width="16" height="16" />'; $regions = Lookup::country_zones(); $base = $Ecart->Settings->get('base_operations'); $js = "var regions = ".json_encode($regions).",". "SHIPCALC_STATUS = '".$options['shipcalc']."',". "d_pm = '".sanitize_title_with_dashes($this->paymethod)."',". "pm_cards = {};"; foreach ($this->payoptions as $handle => $option) { if (empty($option->cards)) continue; $js .= "pm_cards['".$handle."'] = ".json_encode($option->cards).";"; } add_storefrontjs($js,true); if (!empty($options['value'])) $value = $options['value']; else $value = "process"; $output = '<div><input type="hidden" name="checkout" value="'.$value.'" /></div>'; if ($value == "confirmed") $output = apply_filters('ecart_confirm_form',$output); else $output = apply_filters('ecart_checkout_form',$output); return $output; break; case "errors": case "error": $Errors = &EcartErrors(); if (!$Errors->exist(ECART_COMM_ERR)) return false; $errors = $Errors->get(ECART_COMM_ERR); $defaults = array( 'before' => '<li>', 'after' => '</li>' ); $options = array_merge($defaults,$options); extract($options); $result = ""; foreach ((array)$errors as $error) if (!$error->blank()) $result .= $before.$error->message(true).$after; return $result; break; case "cart-summary": ob_start(); include(ECART_TEMPLATES."/summary.php"); $content = ob_get_contents(); ob_end_clean(); // If inside the checkout form, strip the extra <form> tag so we don't break standards // This is ugly, but necessary given the different markup contexts the cart summary is used in $Storefront =& EcartStorefront(); if ($Storefront !== false && $Storefront->checkout) $content = preg_replace('/<\/?form.*?>/','',$content); return $content; break; case "loggedin": return $this->Customer->login; break; case "notloggedin": return (!$this->Customer->login && $Ecart->Settings->get('account_system') != "none"); break; case "email-login": // Deprecating case "loginname-login": // Deprecating case "account-login": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['account-login'])) $options['value'] = $_POST['account-login']; return '<input type="text" name="account-login" id="account-login"'.inputattrs($options).' />'; break; case "password-login": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['password-login'])) $options['value'] = $_POST['password-login']; return '<input type="password" name="password-login" id="password-login" '.inputattrs($options).' />'; break; case "submit-login": // Deprecating case "login-button": $string = '<input type="hidden" name="process-login" id="process-login" value="false" />'; $string .= '<input type="submit" name="submit-login" id="submit-login" '.inputattrs($options).' />'; return $string; break; case "firstname": if ($options['mode'] == "value") return $this->Customer->firstname; if (!empty($this->Customer->firstname)) $options['value'] = $this->Customer->firstname; return '<input type="text" name="firstname" id="firstname" '.inputattrs($options).' />'; break; case "lastname": if ($options['mode'] == "value") return $this->Customer->lastname; if (!empty($this->Customer->lastname)) $options['value'] = $this->Customer->lastname; return '<input type="text" name="lastname" id="lastname" '.inputattrs($options).' />'; break; case "email": if ($options['mode'] == "value") return $this->Customer->email; if (!empty($this->Customer->email)) $options['value'] = $this->Customer->email; return '<input type="text" name="email" id="email" '.inputattrs($options).' />'; break; case "loginname": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if ($options['mode'] == "value") return $this->Customer->loginname; if (!empty($this->Customer->loginname)) $options['value'] = $this->Customer->loginname; return '<input type="text" name="loginname" id="login" '.inputattrs($options).' />'; break; case "password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if ($options['mode'] == "value") return strlen($this->Customer->password) == 34?str_pad('•',8):$this->Customer->password; if (!empty($this->Customer->password)) $options['value'] = $this->Customer->password; return '<input type="password" name="password" id="password" '.inputattrs($options).' />'; break; case "confirm-password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Customer->_confirm_password)) $options['value'] = $this->Customer->_confirm_password; return '<input type="password" name="confirm-password" id="confirm-password" '.inputattrs($options).' />'; break; case "phone": if ($options['mode'] == "value") return $this->Customer->phone; if (!empty($this->Customer->phone)) $options['value'] = $this->Customer->phone; return '<input type="text" name="phone" id="phone" '.inputattrs($options).' />'; break; case "organization": case "company": if ($options['mode'] == "value") return $this->Customer->company; if (!empty($this->Customer->company)) $options['value'] = $this->Customer->company; return '<input type="text" name="company" id="company" '.inputattrs($options).' />'; break; case "marketing": if ($options['mode'] == "value") return $this->Customer->marketing; if (!empty($this->Customer->marketing)) $options['value'] = $this->Customer->marketing; $attrs = array("accesskey","alt","checked","class","disabled","format", "minlength","maxlength","readonly","size","src","tabindex", "title"); $input = '<input type="hidden" name="marketing" value="no" />'; $input .= '<input type="checkbox" name="marketing" id="marketing" value="yes" '.inputattrs($options,$attrs).' />'; return $input; break; case "customer-info": $defaults = array( 'name' => false, // REQUIRED 'info' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'cols' => '30', 'rows' => '3', 'options' => '' ); $op = array_merge($defaults,$options); extract($op); // Allowed input types $allowed_types = array("text","hidden","password","checkbox","radio","textarea","menu"); // Input types that can override option-specified value with the loaded data value $value_override = array("text","hidden","password","textarea","menu"); /// Allowable attributes for textarea inputs $textarea_attrs = array('accesskey','title','tabindex','class','disabled','required'); if (!$name) { // Iterator for order data if (!isset($this->_customer_info_loop)) { reset($this->Customer->info->named); $this->_customer_info_loop = true; } else next($this->Customer->info->named); if (current($this->Customer->info->named) !== false) return true; else { unset($this->_customer_info_loop); return false; } } if (isset($this->Customer->info->named[$name])) $info = $this->Customer->info->named[$name]; if ($name && $mode == "value") return $info; if (!in_array($type,$allowed_types)) $type = 'hidden'; if (empty($title)) $title = $name; $id = 'customer-info-'.sanitize_title_with_dashes($name); if (in_array($type,$value_override) && !empty($info)) $value = $info; switch (strtolower($type)) { case "textarea": return '<textarea name="info['.$name.']" cols="'.$cols.'" rows="'.$rows.'" id="'.$id.'" '.inputattrs($op,$textarea_attrs).'>'.$value.'</textarea>'; break; case "menu": if (is_string($options)) $options = explode(',',$options); return '<select name="info['.$name.']" id="'.$id.'" '.inputattrs($op,$select_attrs).'>'.menuoptions($options,$value).'</select>'; break; default: return '<input type="'.$type.'" name="info['.$name.']" id="'.$id.'" '.inputattrs($op).' />'; break; } break; // SHIPPING TAGS case "shipping": return (!empty($this->shipped)); break; case "shipping-address": if ($options['mode'] == "value") return $this->Shipping->address; if (!empty($this->Shipping->address)) $options['value'] = $this->Shipping->address; return '<input type="text" name="shipping[address]" id="shipping-address" '.inputattrs($options).' />'; break; case "shipping-xaddress": if ($options['mode'] == "value") return $this->Shipping->xaddress; if (!empty($this->Shipping->xaddress)) $options['value'] = $this->Shipping->xaddress; return '<input type="text" name="shipping[xaddress]" id="shipping-xaddress" '.inputattrs($options).' />'; break; case "shipping-city": if ($options['mode'] == "value") return $this->Shipping->city; if (!empty($this->Shipping->city)) $options['value'] = $this->Shipping->city; return '<input type="text" name="shipping[city]" id="shipping-city" '.inputattrs($options).' />'; break; case "shipping-province": case "shipping-state": if ($options['mode'] == "value") return $this->Shipping->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Shipping->state)) { $options['selected'] = $this->Shipping->state; $options['value'] = $this->Shipping->state; } $output = false; $country = $base['country']; if (!empty($this->Shipping->country)) $country = $this->Shipping->country; if (!array_key_exists($country,$countries)) $country = key($countries); $regions = Lookup::country_zones(); $states = $regions[$country]; if (isset($options['options']) && empty($states)) $states = explode(",",$options['options']); if (isset($options['type']) && $options['type'] == "text") return '<input type="text" name="shipping[state]" id="shipping-state" '.inputattrs($options).'/>'; $classname = isset($options['class'])?$options['class']:''; $label = (!empty($options['label']))?$options['label']:''; $options['disabled'] = 'disabled'; $options['class'] = ($classname?"$classname ":"").'disabled hidden'; $output .= '<select name="shipping[state]" id="shipping-state-menu" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="">'.$label.'</option>'; if (is_array($states) && !empty($states)) $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; unset($options['disabled']); $options['class'] = $classname; $output .= '<input type="text" name="shipping[state]" id="shipping-state" '.inputattrs($options).'/>'; return $output; break; case "shipping-postcode": if ($options['mode'] == "value") return $this->Shipping->postcode; if (!empty($this->Shipping->postcode)) $options['value'] = $this->Shipping->postcode; return '<input type="text" name="shipping[postcode]" id="shipping-postcode" '.inputattrs($options).' />'; break; case "shipping-country": if ($options['mode'] == "value") return $this->Shipping->country; if (!empty($this->Shipping->country)) $options['selected'] = $this->Shipping->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $output = '<select name="shipping[country]" id="shipping-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "same-shipping-address": $label = __("Same shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; $checked = ' checked="checked"'; if (isset($options['checked']) && !value_is_true($options['checked'])) $checked = ''; $output = '<label for="same-shipping"><input type="checkbox" name="sameshipaddress" value="on" id="same-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; case "residential-shipping-address": $label = __("Residential shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; if (isset($options['checked']) && value_is_true($options['checked'])) $checked = ' checked="checked"'; $output = '<label for="residential-shipping"><input type="hidden" name="shipping[residential]" value="no" /><input type="checkbox" name="shipping[residential]" value="yes" id="residential-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; // BILLING TAGS case "billing-required": // DEPRECATED case "card-required": if ($this->Cart->Totals->total == 0) return false; foreach ($Ecart->Gateways->active as $gateway) if (!empty($gateway->cards)) return true; return false; break; case "billing-address": if ($options['mode'] == "value") return $this->Billing->address; if (!empty($this->Billing->address)) $options['value'] = $this->Billing->address; return '<input type="text" name="billing[address]" id="billing-address" '.inputattrs($options).' />'; break; case "billing-xaddress": if ($options['mode'] == "value") return $this->Billing->xaddress; if (!empty($this->Billing->xaddress)) $options['value'] = $this->Billing->xaddress; return '<input type="text" name="billing[xaddress]" id="billing-xaddress" '.inputattrs($options).' />'; break; case "billing-city": if ($options['mode'] == "value") return $this->Billing->city; if (!empty($this->Billing->city)) $options['value'] = $this->Billing->city; return '<input type="text" name="billing[city]" id="billing-city" '.inputattrs($options).' />'; break; case "billing-province": case "billing-state": if ($options['mode'] == "value") return $this->Billing->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->state)) { $options['selected'] = $this->Billing->state; $options['value'] = $this->Billing->state; } $output = false; $country = $base['country']; if (!empty($this->Billing->country)) $country = $this->Billing->country; if (!array_key_exists($country,$countries)) $country = key($countries); $regions = Lookup::country_zones(); $states = $regions[$country]; if (isset($options['options']) && empty($states)) $states = explode(",",$options['options']); if (isset($options['type']) && $options['type'] == "text") return '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>'; $classname = isset($options['class'])?$options['class']:''; $label = (!empty($options['label']))?$options['label']:''; $options['disabled'] = 'disabled'; $options['class'] = ($classname?"$classname ":"").'disabled hidden'; $output .= '<select name="billing[state]" id="billing-state-menu" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="">'.$label.'</option>'; if (is_array($states) && !empty($states)) $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; unset($options['disabled']); $options['class'] = $classname; $output .= '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>'; return $output; break; case "billing-postcode": if ($options['mode'] == "value") return $this->Billing->postcode; if (!empty($this->Billing->postcode)) $options['value'] = $this->Billing->postcode; return '<input type="text" name="billing[postcode]" id="billing-postcode" '.inputattrs($options).' />'; break; case "billing-country": if ($options['mode'] == "value") return $this->Billing->country; if (!empty($this->Billing->country)) $options['selected'] = $this->Billing->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $output = '<select name="billing[country]" id="billing-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "billing-card": if ($options['mode'] == "value") return str_repeat('X',strlen($this->Billing->card)-4) .substr($this->Billing->card,-4); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!empty($this->Billing->card)) { $options['value'] = $this->Billing->card; $this->Billing->card = ""; } if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; return '<input type="text" name="billing[card]" id="billing-card" '.inputattrs($options).' />'; break; case "billing-cardexpires-mm": if ($options['mode'] == "value") return date("m",$this->Billing->cardexpires); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardexpires)) $options['value'] = date("m",$this->Billing->cardexpires); return '<input type="text" name="billing[cardexpires-mm]" id="billing-cardexpires-mm" '.inputattrs($options).' />'; break; case "billing-cardexpires-yy": if ($options['mode'] == "value") return date("y",$this->Billing->cardexpires); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardexpires)) $options['value'] = date("y",$this->Billing->cardexpires); return '<input type="text" name="billing[cardexpires-yy]" id="billing-cardexpires-yy" '.inputattrs($options).' />'; break; case "billing-cardtype": if ($options['mode'] == "value") return $this->Billing->cardtype; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->cardtype)) $options['selected'] = $this->Billing->cardtype; $cards = array(); foreach ($this->paycards as $paycard) $cards[$paycard->symbol] = $paycard->name; $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[cardtype]" id="billing-cardtype" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="" selected="selected">'.$label.'</option>'; $output .= menuoptions($cards,$options['selected'],true); $output .= '</select>'; $js = array(); $js[] = "var paycards = {};"; foreach ($this->paycards as $handle => $paycard) { $js[] = "paycards['".$handle."'] = ".json_encode($paycard).";"; } add_storefrontjs(join("",$js), true); return $output; break; case "billing-cardholder": if ($options['mode'] == "value") return $this->Billing->cardholder; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardholder)) $options['value'] = $this->Billing->cardholder; return '<input type="text" name="billing[cardholder]" id="billing-cardholder" '.inputattrs($options).' />'; break; case "billing-cvv": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['billing']['cvv'])) $options['value'] = $_POST['billing']['cvv']; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; return '<input type="text" name="billing[cvv]" id="billing-cvv" '.inputattrs($options).' />'; break; case "billing-xcsc-required": $Gateways = $Ecart->Gateways->active; foreach ($Gateways as $Gateway) { foreach ((array)$Gateway->settings['cards'] as $card) { $PayCard = Lookup::paycard($card); if (!empty($PayCard->inputs)) return true; } } return false; break; case "billing-xcsc": if (empty($options['input'])) return; $input = $options['input']; $cards = array(); $valid = array(); // Collect valid card inputs for all gateways foreach ($this->payoptions as $payoption) { foreach ($payoption->cards as $card) { $PayCard = Lookup::paycard($card); if (empty($PayCard->inputs)) continue; $cards[] = $PayCard->symbol; foreach ($PayCard->inputs as $field => $size) $valid[$field] = $size; } } if (!array_key_exists($input,$valid)) return; if (!empty($_POST['billing']['xcsc'][$input])) $options['value'] = $_POST['billing']['xcsc'][$input]; $options['class'] = isset($options['class']) ? $options['class'].' paycard xcsc':'paycard xcsc'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; $string = '<input type="text" name="billing[xcsc]['.$input.']" id="billing-xcsc-'.$input.'" '.inputattrs($options).' />'; return $string; break; case "billing-xco": return; break; // DEPRECATED case "billing-localities": $rates = $Ecart->Settings->get("taxrates"); foreach ((array)$rates as $rate) if (isset($rate['locals']) && is_array($rate['locals'])) return true; return false; break; case "billing-locale": if ($options['mode'] == "value") return $this->Billing->locale; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->locale)) { $options['selected'] = $this->Billing->locale; $options['value'] = $this->Billing->locale; } if (empty($options['type'])) $options['type'] = "menu"; $output = false; $rates = $Ecart->Settings->get("taxrates"); foreach ($rates as $rate) if (is_array($rate['locals'])) $locales[$rate['country'].$rate['zone']] = array_keys($rate['locals']); add_storefrontjs('var locales = '.json_encode($locales).';',true); $Taxes = new CartTax(); $rate = $Taxes->rate(false,true); $localities = array_keys($rate['locals']); $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[locale]" id="billing-locale" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($localities,$options['selected']); $output .= '</select>'; return $output; break; case "has-data": case "hasdata": return (is_array($this->data) && count($this->data) > 0); break; case "order-data": case "orderdata": $defaults = array( 'name' => false, // REQUIRED 'data' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'cols' => '30', 'rows' => '3', 'options' => '' ); $op = array_merge($defaults,$options); extract($op); // Allowed input types $allowed_types = array("text","hidden","password","checkbox","radio","textarea","menu"); // Input types that can override option-specified value with the loaded data value $value_override = array("text","hidden","password","textarea","menu"); /// Allowable attributes for textarea inputs $textarea_attrs = array('accesskey','title','tabindex','class','disabled','required'); if (!$name) { // Iterator for order data if (!isset($this->_data_loop)) { reset($this->data); $this->_data_loop = true; } else next($this->data); if (current($this->data) !== false) return true; else { unset($this->_data_loop); return false; } } if (isset($this->data[$name])) $data = $this->data[$name]; if ($name && $mode == "value") return $data; if (!in_array($type,$allowed_types)) $type = 'hidden'; if (empty($title)) $title = $name; $id = 'order-data-'.sanitize_title_with_dashes($name); if (in_array($type,$value_override) && !empty($data)) $value = $data; switch (strtolower($type)) { case "textarea": return '<textarea name="data['.$name.']" cols="'.$cols.'" rows="'.$rows.'" id="'.$id.'" '.inputattrs($op,$textarea_attrs).'>'.$value.'</textarea>'; break; case "menu": if (is_string($options)) $options = explode(',',$options); return '<select name="data['.$name.']" id="'.$id.'" '.inputattrs($op,$select_attrs).'>'.menuoptions($options,$value).'</select>'; break; default: return '<input type="'.$type.'" name="data['.$name.']" id="'.$id.'" '.inputattrs($op).' />'; break; } break; case "data": if (!is_array($this->data)) return false; $data = current($this->data); $name = key($this->data); if (isset($options['name'])) return $name; return $data; break; case "submit": if (!isset($options['value'])) $options['value'] = __('Submit Order','Ecart'); $options['class'] = isset($options['class'])?$options['class'].' checkout-button':'checkout-button'; $wrapclass = ''; if (isset($options['wrapclass'])) $wrapclass = ' '.$options['wrapclass']; $buttons = array('<input type="submit" name="process" id="checkout-button" '.inputattrs($options,$submit_attrs).' />'); if (!$this->Cart->orderisfree()) $buttons = apply_filters('ecart_checkout_submit_button',$buttons,$options,$submit_attrs); $_ = array(); foreach ($buttons as $label => $button) $_[] = '<span class="payoption-button payoption-'.sanitize_title_with_dashes($label).($label === 0?$wrapclass:'').'">'.$button.'</span>'; return join("\n",$_); break; case "confirm-button": if (empty($options['errorlabel'])) $options['errorlabel'] = __('Return to Checkout','Ecart'); if (empty($options['value'])) $options['value'] = __('Confirm Order','Ecart'); $button = '<input type="submit" name="confirmed" id="confirm-button" '.inputattrs($options,$submit_attrs).' />'; $return = '<a href="'.ecarturl(false,'checkout',$this->security()).'"'.inputattrs($options,array('class')).'>'. $options['errorlabel'].'</a>'; if (!$this->validated) $markup = $return; else $markup = $button; return apply_filters('ecart_checkout_confirm_button',$markup,$options,$submit_attrs); break; case "local-payment": return true; break; // DEPRECATED case "xco-buttons": return; break; // DEPRECATED case "payoptions": case "payment-options": case "paymentoptions": if ($this->Cart->orderisfree()) return false; $payment_methods = apply_filters('ecart_payment_methods',count($this->payoptions)); if ($payment_methods <= 1) return false; // Skip if only one gateway is active $defaults = array( 'default' => false, 'exclude' => false, 'type' => 'menu', 'mode' => false ); $options = array_merge($defaults,$options); extract($options); unset($options['type']); if ("loop" == $mode) { if (!isset($this->_pay_loop)) { reset($this->payoptions); $this->_pay_loop = true; } else next($this->payoptions); if (current($this->payoptions) !== false) return true; else { unset($this->_pay_loop); return false; } return true; } $excludes = array_map('sanitize_title_with_dashes',explode(",",$exclude)); $payoptions = array_keys($this->payoptions); $payoptions = array_diff($payoptions,$excludes); $paymethod = current($payoptions); if ($default !== false && !isset($this->_paymethod_selected)) { $default = sanitize_title_with_dashes($default); if (in_array($default,$payoptions)) $paymethod = $default; } if ($this->paymethod != $paymethod) { $this->paymethod = $paymethod; $processor = $this->payoptions[$this->paymethod]->processor; if (!empty($processor)) $this->processor($processor); } $output = ''; switch ($type) { case "list": $output .= '<span><ul>'; foreach ($payoptions as $value) { if (in_array($value,$excludes)) continue; $payoption = $this->payoptions[$value]; $options['value'] = $value; $options['checked'] = ($this->paymethod == $value)?'checked':false; if ($options['checked'] === false) unset($options['checked']); $output .= '<li><label><input type="radio" name="paymethod" '.inputattrs($options).' /> '.$payoption->label.'</label></li>'; } $output .= '</ul></span>'; break; case "hidden": if (!isset($options['value']) && $default) $options['value'] = $this->paymethod; $output .= '<input type="hidden" name="paymethod"'.inputattrs($options).' />'; break; default: $output .= '<select name="paymethod" '.inputattrs($options,$select_attrs).'>'; foreach ($payoptions as $value) { if (in_array($value,$excludes)) continue; $payoption = $this->payoptions[$value]; $selected = ($this->paymethod == $value)?' selected="selected"':''; $output .= '<option value="'.$value.'"'.$selected.'>'.$payoption->label.'</option>'; } $output .= '</select>'; break; } return $output; break; case "payoption": case "payment-option": case "paymentoption": $payoption = current($this->payoptions); $defaults = array( 'labelpos' => 'after', 'labeling' => false, 'type' => 'hidden', ); $options = array_merge($defaults,$options); extract($options); if (value_is_true($return)) return $payoption; $types = array('radio','checkbox','hidden'); if (!in_array($type,$types)) $type = 'hidden'; if (empty($options['value'])) $options['value'] = key($this->payoptions); $_ = array(); if (value_is_true($labeling)) $_[] = '<label>'; if ($labelpos == "before") $_[] = $payoption->label; $_[] = '<input type="'.$type.'" name="paymethod"'.inputattrs($options).' />'; if ($labelpos == "after") $_[] = $payoption->label; if (value_is_true($labeling)) $_[] = '</label>'; return join("",$_); break; case "gatewayinputs": case "gateway-inputs": return apply_filters('ecart_checkout_gateway_inputs',false); break; case "completed": if (empty($Ecart->Purchase->id) && $this->purchase !== false) { $Ecart->Purchase = new Purchase($this->purchase); $Ecart->Purchase->load_purchased(); return (!empty($Ecart->Purchase->id)); } return false; break; case "receipt": if (!empty($Ecart->Purchase->id)) return $Ecart->Purchase->receipt(); break; } }
<?php echo $form->labelEx($model, 'tags'); ?> <div class="controls"> <?php $this->widget('CAutoComplete', array('model' => $model, 'attribute' => 'tags', 'url' => array('suggestTags'), 'multiple' => true, 'htmlOptions' => array('size' => 50))); ?> <p class="hint">Please separate different tags with commas.</p> <?php echo $form->error($model, 'tags'); ?> </div> </div> <?php echo $form->dropDownListControlGroup($model, 'status', Lookup::items('PostStatus')); ?> <?php echo $form->dropDownListControlGroup($model, 'language', array('zh_cn' => '中文', 'en' => '英文')); ?> <div class="form-actions"> <?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'size' => TbHtml::BUTTON_SIZE_LARGE)); ?> </div> <?php $this->endWidget(); ?>
public function screen() { $shipcarriers = Lookup::shipcarriers(); $serviceareas = array('*', ShoppBaseLocale()->code()); foreach ($shipcarriers as $c => $record) { if (!in_array($record->areas, $serviceareas)) { continue; } $carriers[$c] = $record->name; } unset($shipcarriers); $shipping_carriers = shopp_setting('shipping_carriers'); if (empty($shipping_carriers)) { $shipping_carriers = array_keys($carriers); } $imperial = 'imperial' == ShoppBaseLocale()->units(); $weights = $imperial ? array('oz' => Shopp::__('ounces (oz)'), 'lb' => Shopp::__('pounds (lbs)')) : array('g' => Shopp::__('gram (g)'), 'kg' => Shopp::__('kilogram (kg)')); $weightsmenu = menuoptions($weights, shopp_setting('weight_unit'), true); $dimensions = $imperial ? array('in' => Shopp::__('inches (in)'), 'ft' => Shopp::__('feet (ft)')) : array('cm' => Shopp::__('centimeters (cm)'), 'm' => Shopp::__('meters (m)')); $dimsmenu = menuoptions($dimensions, shopp_setting('dimension_unit'), true); $rates = shopp_setting('shipping_rates'); if (!empty($rates)) { ksort($rates); } $Shopp = Shopp::object(); $Shipping = $Shopp->Shipping; $Shipping->settings(); // Load all installed shipping modules for settings UIs $methods = $Shopp->Shipping->methods; $edit = false; if (isset($_REQUEST['id'])) { $edit = (int) $_REQUEST['id']; } $active = shopp_setting('active_shipping'); if (!$active) { $active = array(); } if (isset($_POST['module'])) { $setting = false; $module = isset($_POST['module']) ? $_POST['module'] : false; $id = isset($_POST['id']) ? $_POST['id'] : false; if ($id == $module) { if (isset($_POST['settings'])) { shopp_set_formsettings(); } /** Save shipping service settings **/ $active[$module] = true; shopp_set_setting('active_shipping', $active); $updated = __('Shipping settings saved.', 'Shopp'); // Cancel editing if saving if (isset($_POST['save'])) { unset($_REQUEST['id']); } $Errors = ShoppErrors(); do_action('shopp_verify_shipping_services'); if ($Errors->exist()) { // Get all addon related errors $failures = $Errors->level(SHOPP_ADDON_ERR); if (!empty($failures)) { $updated = __('Shipping settings saved but there were errors: ', 'Shopp'); foreach ($failures as $error) { $updated .= '<p>' . $error->message(true, true) . '</p>'; } } } } else { /** Save shipping calculator settings **/ $setting = $_POST['id']; if (empty($setting)) { // Determine next available setting ID $index = 0; if (is_array($active[$module])) { $index = count($active[$module]); } $setting = "{$module}-{$index}"; } // Cancel editing if saving if (isset($_POST['save'])) { unset($_REQUEST['id']); } $setting_module = $setting; $id = 0; if (false !== strpos($setting, '-')) { list($setting_module, $id) = explode('-', $setting); } // Prevent fishy stuff from happening if ($module != $setting_module) { $module = false; } // Save shipping calculator settings $Shipper = $Shipping->get($module); if ($Shipper && isset($_POST[$module])) { $Shipper->setting($id); $_POST[$module]['label'] = stripslashes($_POST[$module]['label']); // Sterilize $values foreach ($_POST[$module]['table'] as $i => &$row) { if (isset($row['rate'])) { $row['rate'] = Shopp::floatval($row['rate']); } if (!isset($row['tiers'])) { continue; } foreach ($row['tiers'] as &$tier) { if (isset($tier['rate'])) { $tier['rate'] = Shopp::floatval($tier['rate']); } } } // Delivery estimates: ensure max equals or exceeds min ShippingFramework::sensibleestimates($_POST[$module]['mindelivery'], $_POST[$module]['maxdelivery']); shopp_set_setting($Shipper->setting, $_POST[$module]); if (!array_key_exists($module, $active)) { $active[$module] = array(); } $active[$module][(int) $id] = true; shopp_set_setting('active_shipping', $active); $this->notice(Shopp::__('Shipping settings saved.')); } } } $postcodes = ShoppLookup::postcodes(); foreach ($postcodes as &$postcode) { $postcode = !empty($postcode); } $lookup = array('regions' => array_merge(array('*' => Shopp::__('Anywhere')), ShoppLookup::regions()), 'regionmap' => ShoppLookup::regions('id'), 'countries' => ShoppLookup::countries(), 'areas' => ShoppLookup::country_areas(), 'zones' => ShoppLookup::country_zones(), 'postcodes' => $postcodes); $ShippingTemplates = new TemplateShippingUI(); add_action('shopp_shipping_module_settings', array($Shipping, 'templates')); $Table = $this->table; $Table->prepare_items(); include $this->ui('shipping.php'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Lookup::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404); } } return $this->_model; }
<?php $this->pageTitle = Yii::app()->name . ' - ' . Yii::t('ui', 'View Person'); $this->breadcrumbs = array(Yii::t('ui', 'Persons') => $this->getReturnUrl() ? $this->getReturnUrl() : array('index'), $model->firstname . ' ' . $model->lastname); ?> <h2><?php echo Yii::t('ui', 'View Person'); ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'id', 'visible' => Yii::app()->user->name == 'admin' ? true : false), 'firstname', 'lastname', 'birthyear', 'email:email', 'webpage:url', array('name' => 'country_id', 'value' => $model->country->name), array('name' => 'eyecolor_code', 'value' => Lookup::item('eyecolor', $model->eyecolor_code)), 'registered'))); ?> <br /> <div class="tpanel"> <div class="toggle"><?php echo Yii::t('ui', 'View code'); ?> </div> <?php $this->beginWidget('CTextHighlighter', array('language' => 'PHP')); ?> $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( array( 'name'=>'id', // only admin user can see person id 'visible'=>Yii::app()->user->name=='admin'? true : false,
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'comment-form', 'enableAjaxValidation' => false)); ?> <p class="note">Поля отмеченные здёздочкой (<span class="required">*</span>) должны быть обязательно заполненны.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'parentTitle'); ?> <?php echo CHtml::link(Lookup::ruitem('CommentType', $model->object_type) . ': ' . $model->object->title, $model->object->url); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'author'); ?> <?php echo $form->textField($model, 'author'); ?> <?php echo $form->error($model, 'author'); ?> </div>
public function management() { $Shopp = Shopp::object(); if (!current_user_can('shopp_settings_checkout')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table); $next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1"); $next_setting = shopp_setting('next_order_id'); if ($next->id > $next_setting) { $next_setting = $next->id; } if (!empty($_POST['save'])) { check_admin_referer('shopp-setup-management'); $next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']); if ($next_order_id >= $next->id) { if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) { $next_setting = $next_order_id; } } shopp_set_formsettings(); $this->notice(Shopp::__('Management settings saved.'), 'notice', 20); } $states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels())); $statusLabels = shopp_setting('order_status'); $statesLabels = shopp_setting('order_states'); $reasonLabels = shopp_setting('cancel_reasons'); if (empty($reasonLabels)) { $reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp')); } include $this->ui('management.php'); }
if ($model->comment != null) { echo '<div class="bug-change-comment">' . CHtml::encode(str_replace("<br>", "\n", $model->comment->text)) . '</div>'; } if ($model->statuschange) { echo '<div class="bug-change-status"><ul>'; if (isset($model->statuschange->status)) { echo '<li>Status: ' . Lookup::item('BugStatus', $model->statuschange->status); } if (isset($model->statuschange->merged_into)) { echo '<li>Merged into bug: ' . CHtml::link($model->statuschange->merged_into, array('bug/view', 'id' => $model->statuschange->merged_into)); } if (isset($model->statuschange->priority)) { echo '<li>Priority: ' . Lookup::item('BugPriority', $model->statuschange->priority); } if (isset($model->statuschange->reproducability)) { echo '<li>Reproducibility: ' . Lookup::item('BugReproducability', $model->statuschange->reproducability); } if (isset($model->statuschange->assigned_to)) { if ($model->statuschange->assigned_to >= 0) { echo '<li>Owner: ' . (isset($model->statuschange->owner) ? CHtml::encode($model->statuschange->owner->username) : 'user was deleted'); } else { echo '<li>Owner: nobody'; } } echo '</ul></div>'; } foreach ($model->attachments as $attachment) { echo '<div class="bug-change-attach">' . CHtml::image(Yii::app()->baseUrl . '/images/file.png') . 'File attached: ' . CHtml::link(CHtml::encode($attachment->filename), array('bug/downloadAttachment', 'id' => $attachment->id)) . ' (' . MiscHelpers::fileSizeToStr($attachment->filesize) . ')' . '</div>'; } ?>
/** * Loads the enabled payment cards * * @since 1.1 * * @return void **/ private function _loadcards () { if (empty($this->settings['cards'])) $this->settings['cards'] = $this->cards; if ($this->cards) { $cards = array(); $pcs = Lookup::paycards(); foreach ($this->cards as $card) { $card = strtolower($card); if (isset($pcs[$card])) $cards[] = $pcs[$card]; } $this->cards = $cards; } }
</div> </div> <!-- Detail View --> <?php // Prepare bug list $bugList = ''; foreach ($model->bugs as $bugCrashReport) { if ($bugCrashReport->bug->status < Bug::STATUS_OPEN_MAX) { $bugList .= CHtml::link('#' . $bugCrashReport->bug_id, array('bug/view', 'id' => $bugCrashReport->bug_id)) . ' '; } if ($bugList == '') { $bugList = 'None'; } } $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'received', 'type' => 'text', 'value' => date("d/m/y H:i", $model->received)), array('name' => 'date_created', 'type' => 'text', 'value' => date("d/m/y H:i", $model->date_created)), array('name' => 'status', 'type' => 'text', 'value' => Lookup::item('CrashReportStatus', $model->status)), array('name' => 'filesize', 'type' => 'raw', 'value' => CHtml::encode(MiscHelpers::fileSizeToStr($model->filesize))), array('name' => 'project_id', 'type' => 'text', 'value' => $model->project->name), array('name' => 'appversion_id', 'type' => 'text', 'value' => $model->appVersion->version), 'crashguid', array('name' => 'crashrptver', 'type' => 'text', 'value' => 'CrashRpt ' . CrashReport::generatorVersionToStr($model->crashrptver)), array('name' => 'srcfilename', 'type' => 'raw', 'value' => CHtml::link($model->srcfilename, array('crashReport/download', 'id' => $model->id))), array('name' => 'groupid', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode($model->collection->title), array('crashGroup/view', 'id' => $model->groupid))), array('label' => 'Open Bug(s)', 'type' => 'raw', 'value' => $bugList)))); ?> <div class="span-27 last detail-group-caption">Sender Info:</div> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'geo_location', 'type' => 'text', 'value' => CrashReport::geoIdToCountryName($model->geo_location)), 'ipaddress', 'emailfrom', 'description'))); ?> <div class="span-27 last detail-group-caption">Exception Info:</div> <?php $text = $model->exception_thread_id != 0 ? '0x' . dechex($model->exception_thread_id) : null; $exceptionThread = $model->getExceptionThread(); if ($exceptionThread) { $link = CHtml::link(CHtml::encode('View Stack Trace'), array('crashReport/view', 'id' => $model->id, 'tab' => 'Threads', 'thread' => $exceptionThread->id));
<?php $this->breadcrumbs = array('Manage Posts'); ?> <h1>Manage Posts</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->title), $data->url)'), array('name' => 'status', 'value' => 'Lookup::item("PostStatus",$data->status)', 'filter' => Lookup::items('PostStatus')), array('name' => 'create_time', 'type' => 'datetime', 'filter' => false), array('class' => 'CButtonColumn'))));
<?php include_once $_SERVER["DOC_ROOT"] . "/scripts/php/core.php"; if (isset($_POST["code"])) { echo Lookup::Alert($_POST["code"]); }
/** * Interface processor for the order manager * * @author Jonathan Davis * @return void **/ public function manager() { global $Shopp, $Notes; global $is_IIS; if (!current_user_can('shopp_orders')) { wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp')); } $Purchase = ShoppPurchase(); $Purchase->Customer = new ShoppCustomer($Purchase->customer); $Gateway = $Purchase->gateway(); if (!empty($_POST["send-note"])) { $user = wp_get_current_user(); shopp_add_order_event($Purchase->id, 'note', array('note' => stripslashes($_POST['note']), 'user' => $user->ID)); $Purchase->load_events(); } // Handle Order note processing if (!empty($_POST['note'])) { $this->addnote($Purchase->id, stripslashes($_POST['note']), !empty($_POST['send-note'])); } if (!empty($_POST['delete-note'])) { $noteid = key($_POST['delete-note']); $Note = new ShoppMetaObject(array('id' => $noteid, 'type' => 'order_note')); $Note->delete(); } if (!empty($_POST['edit-note'])) { $noteid = key($_POST['note-editor']); $Note = new ShoppMetaObject(array('id' => $noteid, 'type' => 'order_note')); $Note->value->message = stripslashes($_POST['note-editor'][$noteid]); $Note->save(); } $Notes = new ObjectMeta($Purchase->id, 'purchase', 'order_note'); if (isset($_POST['submit-shipments']) && isset($_POST['shipment']) && !empty($_POST['shipment'])) { $shipments = $_POST['shipment']; foreach ((array) $shipments as $shipment) { shopp_add_order_event($Purchase->id, 'shipped', array('tracking' => $shipment['tracking'], 'carrier' => $shipment['carrier'])); } $updated = __('Shipping notice sent.', 'Shopp'); // Save shipping carrier default preference for the user $userid = get_current_user_id(); $setting = 'shopp_shipping_carrier'; if (!get_user_meta($userid, $setting, true)) { add_user_meta($userid, $setting, $shipment['carrier']); } else { update_user_meta($userid, $setting, $shipment['carrier']); } unset($_POST['ship-notice']); $Purchase->load_events(); } if (isset($_POST['order-action']) && 'refund' == $_POST['order-action']) { if (!current_user_can('shopp_refund')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } $user = wp_get_current_user(); $reason = (int) $_POST['reason']; $amount = Shopp::floatval($_POST['amount']); $Purchase->load_events(); if (!empty($_POST['message'])) { $message = $_POST['message']; $Purchase->message['note'] = $message; } if ($amount <= $Purchase->captured - $Purchase->refunded) { if (!Shopp::str_true($_POST['send'])) { // Force the order status shopp_add_order_event($Purchase->id, 'notice', array('user' => $user->ID, 'kind' => 'refunded', 'notice' => __('Marked Refunded', 'Shopp'))); shopp_add_order_event($Purchase->id, 'refunded', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'amount' => $amount)); shopp_add_order_event($Purchase->id, 'voided', array('txnorigin' => $Purchase->txnid, 'txnid' => time(), 'gateway' => $Gateway->module)); } else { shopp_add_order_event($Purchase->id, 'refund', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'amount' => $amount, 'reason' => $reason, 'user' => $user->ID)); } if (!empty($_POST['message'])) { $this->addnote($Purchase->id, $_POST['message']); } $Purchase->load_events(); } else { $this->notice(Shopp::__('Refund failed. Cannot refund more than the current balance.'), 'error'); } } if (isset($_POST['order-action']) && 'cancel' == $_POST['order-action']) { if (!current_user_can('shopp_void')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } // unset($_POST['refund-order']); $user = wp_get_current_user(); $reason = (int) $_POST['reason']; $message = ''; if (!empty($_POST['message'])) { $message = $_POST['message']; $Purchase->message['note'] = $message; } else { $message = 0; } if (!Shopp::str_true($_POST['send'])) { // Force the order status shopp_add_order_event($Purchase->id, 'notice', array('user' => $user->ID, 'kind' => 'cancelled', 'notice' => __('Marked Cancelled', 'Shopp'))); shopp_add_order_event($Purchase->id, 'voided', array('txnorigin' => $Purchase->txnid, 'txnid' => time(), 'gateway' => $Gateway->module)); } else { shopp_add_order_event($Purchase->id, 'void', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'reason' => $reason, 'user' => $user->ID, 'note' => $message)); } if (!empty($_POST['message'])) { $this->addnote($Purchase->id, $_POST['message']); } $Purchase->load_events(); } if (isset($_POST['billing']) && is_array($_POST['billing'])) { $Purchase->updates($_POST['billing']); $Purchase->save(); } if (isset($_POST['shipping']) && is_array($_POST['shipping'])) { $shipping = array(); foreach ($_POST['shipping'] as $name => $value) { $shipping["ship{$name}"] = $value; } $Purchase->updates($shipping); $Purchase->shipname = $shipping['shipfirstname'] . ' ' . $shipping['shiplastname']; $Purchase->save(); } if (isset($_POST['order-action']) && 'update-customer' == $_POST['order-action'] && !empty($_POST['customer'])) { $Purchase->updates($_POST['customer']); $Purchase->save(); } if (isset($_POST['cancel-edit-customer'])) { unset($_POST['order-action'], $_POST['edit-customer'], $_POST['select-customer']); } if (isset($_POST['order-action']) && 'new-customer' == $_POST['order-action'] && !empty($_POST['customer']) && !isset($_POST['cancel-edit-customer'])) { $Customer = new ShoppCustomer(); $Customer->updates($_POST['customer']); $Customer->password = wp_generate_password(12, true); if ('wordpress' == shopp_setting('account_system')) { $Customer->create_wpuser(); } else { unset($_POST['loginname']); } $Customer->save(); if ((int) $Customer->id > 0) { $Purchase->copydata($Customer); $Purchase->save(); } else { $this->notice(__('An unknown error occured. The customer could not be created.', 'Shopp'), 'error'); } } if (isset($_GET['order-action']) && 'change-customer' == $_GET['order-action'] && !empty($_GET['customerid'])) { $Customer = new ShoppCustomer((int) $_GET['customerid']); if ((int) $Customer->id > 0) { $Purchase->copydata($Customer); $Purchase->customer = $Customer->id; $Purchase->save(); } else { $this->notice(__('The selected customer was not found.', 'Shopp'), 'error'); } } if (isset($_POST['save-item']) && !empty($_POST['lineid'])) { // Create a cart representation of the order to recalculate order totals $Cart = new ShoppCart(); foreach ($Purchase->purchased as $OrderItem) { $CartItem = new Item($OrderItem); $Cart->contents[$OrderItem->id] = $CartItem; } $purchasedid = (int) $_POST['lineid']; $Purchased = $Purchase->purchased[$purchasedid]; if ($Purchased->id) { $override_total = Shopp::floatval($_POST['total']) != $Purchased->total; // Override total $Item = $Cart->contents[$purchasedid]; $Item->quantity($_POST['quantity']); $Item->unitprice = Shopp::floatval($_POST['unitprice']); $Item->retotal(); $Purchased->quantity = $Item->quantity; $Purchased->unitprice = $Item->unitprice; $Purchased->unittax = $Item->unittax; $Purchased->total = $Item->total; if ($override_total) { $Purchased->total = Shopp::floatval($_POST['total']); } $Purchased->save(); } $Cart->retotal = true; $Cart->totals(); $Purchase->copydata($Cart->Totals); $Purchase->save(); } if (isset($_POST['charge']) && $Gateway && $Gateway->captures) { if (!current_user_can('shopp_capture')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } $user = wp_get_current_user(); shopp_add_order_event($Purchase->id, 'capture', array('txnid' => $Purchase->txnid, 'gateway' => $Purchase->gateway, 'amount' => $Purchase->capturable(), 'user' => $user->ID)); $Purchase->load_events(); } $base = shopp_setting('base_operations'); $targets = shopp_setting('target_markets'); $countries = array('' => ' '); $countrydata = Lookup::countries(); foreach ($countrydata as $iso => $c) { if ($base['country'] == $iso) { $base_region = $c['region']; } $countries[$iso] = $c['name']; } $Purchase->_countries = $countries; $regions = Lookup::country_zones(); $Purchase->_billing_states = array_merge(array('' => ' '), (array) $regions[$Purchase->country]); $Purchase->_shipping_states = array_merge(array('' => ' '), (array) $regions[$Purchase->shipcountry]); // Setup shipping carriers menu and JS data $carriers_menu = $carriers_json = array(); $shipping_carriers = (array) shopp_setting('shipping_carriers'); // The store-preferred shipping carriers $shipcarriers = Lookup::shipcarriers(); // The full list of available shipping carriers $notrack = Shopp::__('No Tracking'); // No tracking label $default = get_user_meta(get_current_user_id(), 'shopp_shipping_carrier', true); if (isset($shipcarriers[$default])) { $carriers_menu[$default] = $shipcarriers[$default]->name; $carriers_json[$default] = array($shipcarriers[$default]->name, $shipcarriers[$default]->trackpattern); } else { $carriers_menu['NOTRACKING'] = $notrack; $carriers_json['NOTRACKING'] = array($notrack, false); } $serviceareas = array('*', $base['country']); foreach ($shipcarriers as $code => $carrier) { if ($code == $default) { continue; } if (!empty($shipping_carriers) && !in_array($code, $shipping_carriers)) { continue; } if (!in_array($carrier->areas, $serviceareas)) { continue; } $carriers_menu[$code] = $carrier->name; $carriers_json[$code] = array($carrier->name, $carrier->trackpattern); } if (isset($shipcarriers[$default])) { $carriers_menu['NOTRACKING'] = $notrack; $carriers_json['NOTRACKING'] = array($notrack, false); } if (empty($statusLabels)) { $statusLabels = array(''); } include $this->ui('order.php'); }
?> <?php $this->widget('CAutoComplete', array('model' => $model, 'attribute' => 'tags', 'url' => array('suggestTags'), 'multiple' => true, 'htmlOptions' => array('size' => 50))); ?> <p class="hint">Please separate different tags with commas.</p> <?php echo $form->error($model, 'tags'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'status'); ?> <?php echo $form->dropDownList($model, 'status', Lookup::items('PostStatus')); ?> <?php echo $form->error($model, 'status'); ?> </div> <?php $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => Yii::app()->createUrl('post/upload'), 'allowedExtensions' => array("jpg"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 0))); ?> <div class="row buttons"> <?php
?> <?php $items = Lookup::items('BugPriority'); echo $form->dropDownList($model, 'priority', $items); ?> <?php echo $form->error($model, 'priority'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'reproducability'); ?> <?php $items = Lookup::items('BugReproducability'); echo $form->dropDownList($model, 'reproducability', $items); ?> <?php echo $form->error($model, 'reproducability'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'assigned_to'); ?> <?php $curProject = Yii::app()->user->getCurProject(); $projectUsers = $curProject->users; $items = array();