本文整理汇总了PHP中Lookup类的典型用法代码示例。如果您正苦于以下问题:PHP Lookup类的具体用法?PHP Lookup怎么用?PHP Lookup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lookup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: newlookup_POST
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/");
}
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:26,代码来源:newlookup.php
示例2: rules
/**
* @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()));
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:28,代码来源:User.php
示例3: actionEditBlog
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));
}
开发者ID:KaranSofat,项目名称:yii,代码行数:32,代码来源:PostController.php
示例4: settings_meta_box
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);
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:33,代码来源:ui.php
示例5: country
static function country($data)
{
$countries = Lookup::countries();
if (isset($countries[$data->country])) {
return $countries[$data->country]['name'];
}
return $data->country;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:8,代码来源:locations.php
示例6: testItems
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);
}
开发者ID:xyzz,项目名称:CrashFix,代码行数:9,代码来源:LookupTest.php
示例7: saveLookup
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) {
}
}
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:19,代码来源:Label.php
示例8: actionSearch
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);
}
}
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:55,代码来源:SearchController.php
示例9: screen
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');
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:50,代码来源:OrdersSettings.php
示例10: actionAvatars
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));
}
开发者ID:yunsite,项目名称:my-advertise,代码行数:21,代码来源:FileController.php
示例11: actionAdmin
/**
* 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
));
}
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:25,代码来源:SettingsController.php
示例12:
'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',
),
),
)); ?>
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:31,代码来源:admingrid.php
示例13: orders_widget
/**
* 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;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:47,代码来源:Dashboard.php
示例14: behaviors
/**
* 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);
}
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:53,代码来源:Storefront.php
示例15: state
/**
* 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;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:66,代码来源:customer.php
示例16: tag
/**
* 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'];
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Order.php
示例17: array
<?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();
?>
开发者ID:jackycgq,项目名称:advanced,代码行数:31,代码来源:_form.php
示例18: screen
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'])) {
//.........这里部分代码省略.........
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:ShippingRates.php
示例19: loadModel
/**
* 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;
}
开发者ID:amlap,项目名称:Yii-Extensions,代码行数:16,代码来源:DefaultController.php
示例20: array
<?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,
开发者ID:rizaldi-github,项目名称:Yii-Playground,代码行数:31,代码来源:view.php
注:本文中的Lookup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论