本文整理汇总了PHP中Gender类的典型用法代码示例。如果您正苦于以下问题:PHP Gender类的具体用法?PHP Gender怎么用?PHP Gender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gender类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($pesel)
{
$gender = new Gender($pesel);
$gender->printOut();
$birth = new Birth($pesel);
$birth->printOut();
}
开发者ID:sparrow41,项目名称:training,代码行数:7,代码来源:index.php
示例2: profile
public function profile($id)
{
$user = User::with('gender', 'course', 'userType')->where('StudentID', $id)->first();
$courses = Course::all()->lists('CourseAbbr', 'CourseID');
$genders = Gender::all()->lists('Gender', 'GenderID');
return View::make('validated.profile.edit', compact('user', 'courses', 'genders'));
}
开发者ID:NoName1771,项目名称:QCPU-Social-Web-App,代码行数:7,代码来源:UserController.php
示例3: indexAction
public function indexAction()
{
$db = $this->di->get('db');
try {
var_dump("Start!!");
$db->begin();
var_dump('First transaction is opened. Is under transaction: ' . (int) $db->isUnderTransaction());
var_dump('First transaction is opened. Transaction level is ' . $db->getTransactionLevel());
$gender = \Gender::findFirst(1);
// Create user object and set gender relation
$user = new User();
$user->setName('Roc');
$user->gender = $gender;
// store user, but error occurs
$user->save();
$db->commit();
var_dump("Commit!!!");
var_dump('First transaction is commited. Is under transaction: ' . (int) $db->isUnderTransaction());
var_dump('First transaction is commited. Transaction level is ' . $db->getTransactionLevel());
} catch (\Exception $e) {
var_dump('Catch: ' . $e->getMessage());
$db->rollback();
var_dump('First transaction is rollbacked. Is under transaction: ' . (int) $db->isUnderTransaction());
var_dump('First transaction is rollbacked. Transaction level is ' . $db->getTransactionLevel());
}
/*
* The problem is here.
* Now, when the data are fetched via \Phalcon\MVC\Model, exception 'SQLSTATE[25P02]: In failed sql
* transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block' occurs
*
* If you can use raw sql below, it's correct
*/
try {
$db->begin();
var_dump('Second transaction is opened. Is under transaction: ' . (int) $db->isUnderTransaction());
var_dump('Second transaction is opened. Transaction level is ' . $db->getTransactionLevel());
$users = \User::find();
var_dump($users);
$db->commit();
} catch (\Exception $e) {
var_dump('Catch: ' . $e->getMessage());
$db->rollback();
var_dump('Second transaction is rollbacked. Is under transaction: ' . (int) $db->isUnderTransaction());
var_dump('Second transaction is rollbacked. Transaction level is ' . $db->getTransactionLevel());
}
// $sql = 'select * from users;';
// $result = $db->query($sql);
// $result->setFetchMode(\Phalcon\Db::FETCH_ASSOC);
// $result = $result->fetchAll($result);
// var_dump($result);
var_dump("Done!!!");
die;
}
开发者ID:slechtic,项目名称:phalcon_rollback,代码行数:53,代码来源:IndexController.php
示例4: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
if ($this->customer->birthday) {
$birthday = explode('-', $this->customer->birthday);
} else {
$birthday = array('-', '-', '-');
}
/* Generate years, months and days */
$this->context->smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors, 'genders' => Gender::getGenders()));
if (Module::isInstalled('blocknewsletter')) {
$this->context->smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
}
// start of implementation of the module code - taxamo
// Get selected country
if (Tools::isSubmit('taxamoisocountryresidence') && !is_null(Tools::getValue('taxamoisocountryresidence'))) {
$selected_country = Tools::getValue('taxamoisocountryresidence');
} else {
$selected_country = Taxamoeuvat::getCountryByCustomer($this->customer->id);
}
// Generate countries list
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
/* todo use helper */
$list = '<option value="">-</option>';
foreach ($countries as $country) {
$selected = $country['iso_code'] == $selected_country ? 'selected="selected"' : '';
$list .= '<option value="' . $country['iso_code'] . '" ' . $selected . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
}
// Get selected cc prefix
if (Tools::isSubmit('taxamoccprefix') && !is_null(Tools::getValue('taxamoccprefix'))) {
$taxamo_cc_prefix = Tools::getValue('taxamoccprefix');
} else {
$taxamo_cc_prefix = Taxamoeuvat::getPrefixByCustomer($this->customer->id);
}
if ($this->customer->id) {
$this->context->smarty->assign(array('countries_list' => $list, 'taxamoisocountryresidence' => $selected_country, 'taxamoccprefix' => $taxamo_cc_prefix));
}
// end of code implementation module - taxamo
$this->setTemplate(_PS_THEME_DIR_ . 'identity.tpl');
}
开发者ID:hjcalvo,项目名称:prestashop-taxamo-plugin,代码行数:48,代码来源:IdentityController.php
示例5: renderCustomersList
protected function renderCustomersList($group)
{
$genders = array(0 => '?');
$genders_icon = array('default' => 'unknown.gif');
foreach (Gender::getGenders() as $gender) {
$genders_icon[$gender->id] = '../genders/' . (int) $gender->id . '.jpg';
$genders[$gender->id] = $gender->name;
}
$customer_fields_display = array('id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'), 'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50, 'icon' => $genders_icon, 'list' => $genders), 'firstname' => array('title' => $this->l('Name'), 'align' => 'center'), 'lastname' => array('title' => $this->l('Name'), 'align' => 'center'), 'email' => array('title' => $this->l('E-mail address'), 'width' => 150, 'align' => 'center'), 'birthday' => array('title' => $this->l('Birth date'), 'width' => 150, 'align' => 'right', 'type' => 'date'), 'date_add' => array('title' => $this->l('Register date'), 'width' => 150, 'align' => 'right', 'type' => 'date'), 'orders' => array('title' => $this->l('Orders'), 'align' => 'center'), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'width' => 20, 'active' => 'status', 'type' => 'bool'));
$customer_list = $group->getCustomers(false);
$helper = new HelperList();
$helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
$helper->token = Tools::getAdminTokenLite('AdminCustomers');
$helper->shopLinkType = '';
$helper->table = 'customer';
$helper->identifier = 'id_customer';
$helper->actions = array('edit', 'view');
$helper->show_toolbar = false;
return $helper->generateList($customer_list, $customer_fields_display);
}
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:20,代码来源:AdminGroupsController.php
示例6: get
/**
* Get $num names
* @param $num
* @param $additionalColumns
* @return array
* @throws \Exception
*/
public function get($num, $additionalColumns = [])
{
$out = [];
// check that all columns are allowed
foreach ($additionalColumns as $column) {
if (!in_array($column, $this->allowedColumns)) {
throw new \Exception('column ' . $column . ' not allowed');
}
}
for ($i = 0; $i < $num; $i++) {
$item = [];
$item['gender'] = Gender::getRandom();
$item['first'] = $item['gender'] == Gender::GENDER_MALE ? $this->maleNames->getRandom() : $this->femaleNames->getRandom();
$item['last'] = $this->lastNames->getRandom();
$item['full'] = $item['first'] . ' ' . $item['last'];
foreach ($additionalColumns as $column) {
$item[$column] = $this->{$column}();
}
$out[] = $item;
}
return $out;
}
开发者ID:sedpro,项目名称:namegenerator,代码行数:29,代码来源:Generator.php
示例7: getFormat
public function getFormat()
{
$format = [];
$format['id_customer'] = (new FormField())->setName('id_customer')->setType('hidden');
$genderField = (new FormField())->setName('id_gender')->setType('radio-buttons')->setLabel($this->translator->trans('Social title', [], 'Shop.Forms.Labels'));
foreach (Gender::getGenders($this->language->id) as $gender) {
$genderField->addAvailableValue($gender->id, $gender->name);
}
$format[$genderField->getName()] = $genderField;
$format['firstname'] = (new FormField())->setName('firstname')->setLabel($this->translator->trans('First name', [], 'Shop.Forms.Labels'))->setRequired(true);
$format['lastname'] = (new FormField())->setName('lastname')->setLabel($this->translator->trans('Last name', [], 'Shop.Forms.Labels'))->setRequired(true);
if (Configuration::get('PS_B2B_ENABLE')) {
$format['company'] = (new FormField())->setName('company')->setType('text')->setLabel($this->translator->trans('Company', [], 'Shop.Forms.Labels'));
$format['siret'] = (new FormField())->setName('siret')->setType('text')->setLabel($this->translator->trans('Identification number', [], 'Shop.Forms.Labels'));
}
$format['email'] = (new FormField())->setName('email')->setType('email')->setLabel($this->translator->trans('Email', [], 'Shop.Forms.Labels'))->setRequired(true);
if ($this->ask_for_password) {
$format['password'] = (new FormField())->setName('password')->setType('password')->setLabel($this->translator->trans('Password', [], 'Shop.Forms.Labels'))->setRequired($this->password_is_required);
}
if ($this->ask_for_new_password) {
$format['new_password'] = (new FormField())->setName('new_password')->setType('password')->setLabel($this->translator->trans('New password', [], 'Shop.Forms.Labels'));
}
if ($this->ask_for_birthdate) {
$format['birthday'] = (new FormField())->setName('birthday')->setType('text')->setLabel($this->translator->trans('Birthdate', [], 'Shop.Forms.Labels'))->addAvailableValue('placeholder', Tools::getDateFormat())->addAvailableValue('comment', $this->translator->trans('(E.g.: %date_format%)', array('%date_format%' => Tools::formatDateStr('31 May 1970')), 'Shop.Forms.Help'));
}
if ($this->ask_for_partner_optin) {
$format['optin'] = (new FormField())->setName('optin')->setType('checkbox')->setLabel($this->translator->trans('Receive offers from our partners', [], 'Shop.Theme.CustomerAccount'));
}
$additionalCustomerFormFields = Hook::exec('additionalCustomerFormFields', array(), null, true);
if (!is_array($additionalCustomerFormFields)) {
$additionalCustomerFormFields = array();
}
$format = array_merge($format, $additionalCustomerFormFields);
// TODO: TVA etc.?
return $this->addConstraints($format);
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:36,代码来源:CustomerFormatter.php
示例8: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
/* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
if (empty($this->context->cart->id_carrier)) {
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$checked = (int) Cart::desintifier($checked);
$this->context->cart->id_carrier = $checked;
$this->context->cart->update();
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);
}
// SHOPPING CART
$this->_assignSummaryInformations();
// WRAPPING AND TOS
$this->_assignWrappingAndTOS();
$selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
// If a rule offer free-shipping, force hidding shipping prices
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule) {
if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
$free_shipping = true;
break;
}
}
$this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => (bool) (isset($_GET['isPaymentStep']) && $_GET['isPaymentStep']), 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
$years = Tools::dateYears();
$months = Tools::dateMonths();
$days = Tools::dateDays();
$this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
/* Load guest informations */
if ($this->isLogged && $this->context->cookie->is_guest) {
$this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
}
// ADDRESS
if ($this->isLogged) {
$this->_assignAddress();
}
// CARRIER
$this->_assignCarrier();
// PAYMENT
$this->_assignPayment();
Tools::safePostVars();
$blocknewsletter = Module::getInstanceByName('blocknewsletter');
$this->context->smarty->assign('newsletter', (bool) ($blocknewsletter && $blocknewsletter->active));
$this->_processAddressFormat();
$this->setTemplate(_PS_THEME_DIR_ . 'order-opc.tpl');
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:57,代码来源:OrderOpcController.php
示例9: array
echo $form->textField($model, 'last_name');
?>
</td>
<td><?php
echo $form->error($model, 'last_name');
?>
</td>
</div></tr>
<tr><div class="row">
<td><?php
echo $form->labelEx($model, 'gender');
?>
</td>
<td><?php
echo $form->dropdownList($model, 'gender', CHtml::listData(Gender::model()->findAll(), 'id', 'gender'), array('prompt' => 'Select Gender'));
?>
</td>
<td><?php
echo $form->error($model, 'gender');
?>
</td>
</div></tr>
<tr><div class="row">
<td><?php
echo $form->labelEx($model, 'dob');
?>
</td>
<td> <?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dob', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd', 'minDate' => ''), 'htmlOptions' => array()));
开发者ID:nomannoor,项目名称:social-property,代码行数:31,代码来源:editprofile.php
示例10: retrieveEvents
public function retrieveEvents()
{
$url = NEFUB_ROOT . '/../pages/default.asp?subject_id=20';
$postData = array('category_id' => 205);
$html = $this->getNefubContents($url, 2, $postData);
if (!$html) {
$this->retrieveLog->successfully = 0;
} else {
$this->retrieveLog->successfully = 1;
}
$this->retrieveLog->finish_time = date('Y-m-d H:i:s');
$this->retrieveLog->total_time = $this->retrieveLog->getDuration();
$this->retrieveLog->finished = 1;
$this->retrieveLog->save();
$pattern = '|<td width=\\"100\\" valign=top class=\\"kalender_subtitle\\">(.*){4,16}<td valign=top class=\\"kalender_subtitle\\">([^<]{4,})<br|U';
$result = array();
preg_match_all($pattern, $html, $result, PREG_SET_ORDER);
$aEvents = array();
foreach ($result as $event) {
/*
[35]: Array
[35][0]: <td width="100" valign=top class="kalender_subtitle">za. 12.04.2014</td><td valign=top class="kalender_subtitle"> NeFUB Competitie ronde 15 <br
[35][1]: za. 12.04.2014</td>
[35][2]: NeFUB Competitie ronde 15
*/
$nefubName = utf8_encode(trim($event[2]));
$lowerName = strtolower($nefubName);
$oGenre = null;
$oGender = null;
$oGender2 = null;
if (strpos($lowerName, 'jeugd') !== false) {
$oGenre = Genre::getByNefubName(GENRE_JEUGD_NEFUB_NAME);
$oGender = Gender::getByNefubName(GENDER_MIXED_NEFUB_NAME);
} elseif (strpos($lowerName, 'mixed') !== false) {
$oGenre = Genre::getByNefubName(GENRE_COMPETITIE_NEFUB_NAME);
$oGender = Gender::getByNefubName(GENDER_MIXED_NEFUB_NAME);
} else {
if (strpos($lowerName, 'heren') !== false) {
$oGender = Gender::getByNefubName(GENDER_HEREN_NEFUB_NAME);
} elseif (strpos($lowerName, 'dames') !== false) {
$oGender = Gender::getByNefubName(GENDER_DAMES_NEFUB_NAME);
} else {
$oGender = Gender::getByNefubName(GENDER_HEREN_NEFUB_NAME);
$oGender2 = Gender::getByNefubName(GENDER_DAMES_NEFUB_NAME);
}
if (strpos($lowerName, 'cup') !== false || strpos($lowerName, 'beker') !== false) {
$oGenre = Genre::getByNefubName(GENRE_BEKER_NEFUB_NAME);
} else {
$oGenre = Genre::getByNefubName(GENRE_COMPETITIE_NEFUB_NAME);
}
}
$date = str_replace('</td>', '', $event[1]);
$date = array_pop(explode(' ', $date));
$dates = explode('-', $date);
if (count($dates) > 1) {
if (count($dates) == 2) {
$lastDate = array_pop($dates);
list($lastDay, $month, $year) = explode('.', trim($lastDate));
$firstDay = $dates[0];
$firstDate = $year . '-' . $month . '-' . $firstDay;
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
$lastDate = $year . '-' . $month . '-' . $lastDay;
$oEvent = self::convertEvent($nefubName, $lastDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
self::put("Event " . $nefubName . " toegevoegd");
} else {
self::put("Event " . $nefubName . " niet toegevoegd, ongeldige data:");
self::put($date);
}
} else {
list($day, $month, $year) = explode('.', $date);
$formattedDate = $year . '-' . $month . '-' . $day;
$oEvent = self::convertEvent($nefubName, $formattedDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $formattedDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
self::put("Event " . $nefubName . " toegevoegd");
}
if (count($eventIds)) {
$query = 'DELETE FROM Event WHERE id NOT IN (' . implode(', ', $eventIds) . ') AND season_nefub_id = ' . Season::getInstance()->nefub_id;
Database::query($query);
} else {
Database::delete_rows('Event', array('season_nefub_id' => Season::getInstance()->nefub_id));
}
}
}
开发者ID:rjpijpker,项目名称:nefub-mobile,代码行数:97,代码来源:ScrapeRetriever.php
示例11: FirstName
public function FirstName()
{
if (StakeLeader::IsLoggedIn()) {
return $this->FirstName;
}
$formal = false;
$callings = $this->Callings();
$merited = array("Bishop", "Bishopric 1st Counselor", "Bishopric 2nd Counselor", "High Counselor");
// First check for calling
foreach ($callings as $c) {
if ($c->Name == "Bishop") {
return "Bishop";
}
// Bishop gets own title
if (in_array($c->Name, $merited)) {
$formal = true;
break;
}
}
// Now check age if not already decided
if (!$formal) {
$secondsPerYear = 31557600;
$formal = floor(abs(strtotime(now()) - strtotime($this->Birthday)) / $secondsPerYear) > 30;
}
return $formal ? Gender::RenderLDS($this->Gender) : $this->FirstName;
}
开发者ID:bluegate010,项目名称:ysaward,代码行数:26,代码来源:Member.php
示例12: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
if ($this->customer->birthday) {
$birthday = explode('-', $this->customer->birthday);
} else {
$birthday = array('-', '-', '-');
}
/* Generate years, months and days */
$this->context->smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors, 'genders' => Gender::getGenders()));
$this->context->smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
$this->setTemplate(_PS_THEME_DIR_ . 'identity.tpl');
}
开发者ID:jicheng17,项目名称:vipinsg,代码行数:17,代码来源:IdentityController.php
示例13: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->context->smarty->assign('genders', Gender::getGenders());
$this->assignDate();
$this->assignCountries();
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active;
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN'));
$back = Tools::getValue('back');
$key = Tools::safeOutput(Tools::getValue('key'));
if (!empty($key)) {
$back .= (strpos($back, '?') !== false ? '&' : '?') . 'key=' . $key;
}
if ($back == Tools::secureReferrer(Tools::getValue('back'))) {
$this->context->smarty->assign('back', html_entity_decode($back));
} else {
$this->context->smarty->assign('back', Tools::safeOutput($back));
}
if (Tools::getValue('display_guest_checkout')) {
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
$this->context->smarty->assign(array('inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int) $this->id_country, 'countries' => $countries));
}
if (Tools::getValue('create_account')) {
$this->context->smarty->assign('email_create', 1);
}
if (Tools::getValue('multi-shipping') == 1) {
$this->context->smarty->assign('multi_shipping', true);
} else {
$this->context->smarty->assign('multi_shipping', false);
}
$this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
$this->assignAddressFormat();
// Call a hook to display more information on form
$this->context->smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
// Just set $this->template value here in case it's used by Ajax
$this->setTemplate(_PS_THEME_DIR_ . 'authentication.tpl');
if ($this->ajax) {
// Call a hook to display more information on form
$this->context->smarty->assign(array('PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'genders' => Gender::getGenders()));
$return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'page' => $this->context->smarty->fetch($this->template), 'token' => Tools::getToken(false));
$this->ajaxDie(Tools::jsonEncode($return));
}
}
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:52,代码来源:AuthController.php
示例14: elseif
}
// Consolidate leadership (e.g. leader1, leader3, but no leader2 = messy)
// This also persists (saves) the object in the DB.
$currentGroup->ConsolidateLeaders();
}
// Assign to new group
$mem->FheGroup = $groupID;
// Build the response
$response = "Success";
if (!$groupID) {
$response = "Removed {$mem->FirstName} from " . Gender::PossessivePronoun($mem->Gender) . " group.";
} else {
$response = "Assigned {$mem->FirstName} to group {$mem->FheGroup()->GroupName}.";
}
if ($removedLeader) {
$response .= " This member is no longer a leader of " . Gender::PossessivePronoun($mem->Gender) . " old group.";
}
if ($mem->Save()) {
Response::Send(200, $response);
} else {
Response::Send(500, "Something went wrong; could not save member's new assignment.");
}
} elseif ($action == "del") {
$id = DB::Safe($_GET['id']);
// Remove all members from this group which is about to be deleted
$r = DB::Run("UPDATE Members SET FheGroup=0 WHERE FheGroup={$id}");
if (!$r) {
Response::Send(500, "Could not remove members from FHE group: " . mysql_error());
}
// Delete the group
$r = DB::Run("DELETE FROM FheGroups WHERE id={$id} LIMIT 1");
开发者ID:bluegate010,项目名称:ysaward,代码行数:31,代码来源:fhe.php
示例15: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
if ($this->customer->birthday) {
$birthday = explode('-', $this->customer->birthday);
} else {
$birthday = array('-', '-', '-');
}
/* Generate years, months and days */
$this->context->smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors, 'genders' => Gender::getGenders()));
// Call a hook to display more information
$this->context->smarty->assign(array('HOOK_CUSTOMER_IDENTITY_FORM' => Hook::exec('displayCustomerIdentityForm')));
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active;
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN'));
$this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
$this->setTemplate(_PS_THEME_DIR_ . 'identity.tpl');
}
开发者ID:yewed,项目名称:share,代码行数:22,代码来源:IdentityController.php
示例16: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->context->smarty->assign('genders', Gender::getGenders());
$this->assignDate();
$this->assignCountries();
$active_module_newsletter = false;
if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) {
$active_module_newsletter = $module_newsletter->active;
}
$this->context->smarty->assign('newsletter', (int) $active_module_newsletter);
$back = Tools::getValue('back');
$key = Tools::safeOutput(Tools::getValue('key'));
if (!empty($key)) {
$back .= (strpos($back, '?') !== false ? '&' : '?') . 'key=' . $key;
}
if (!empty($back)) {
$this->context->smarty->assign('back', Tools::safeOutput($back));
}
if (Tools::getValue('display_guest_checkout')) {
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
$this->context->smarty->assign(array('inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int) Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')), 'countries' => $countries));
}
if (Tools::getValue('create_account')) {
$this->context->smarty->assign('email_create', 1);
}
if (Tools::getValue('multi-shipping') == 1) {
$this->context->smarty->assign('multi_shipping', true);
} else {
$this->context->smarty->assign('multi_shipping', false);
}
$this->assignAddressFormat();
// Call a hook to display more information on form
$this->context->smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
if ($this->ajax) {
// Call a hook to display more information on form
$this->context->smarty->assign(array('PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'genders' => Gender::getGenders()));
$return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'page' => $this->context->smarty->fetch(_PS_THEME_DIR_ . 'authentication.tpl'), 'token' => Tools::getToken(false));
die(Tools::jsonEncode($return));
}
$this->setTemplate(_PS_THEME_DIR_ . 'authentication.tpl');
}
开发者ID:jicheng17,项目名称:pengwine,代码行数:50,代码来源:AuthController.php
示例17: renderView
public function renderView()
{
/** @var Customer $customer */
if (!($customer = $this->loadObject())) {
return;
}
$this->context->customer = $customer;
$gender = new Gender($customer->id_gender, $this->context->language->id);
$gender_image = $gender->getImage();
$customer_stats = $customer->getStats();
$sql = 'SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = %d AND valid = 1';
if ($total_customer = Db::getInstance()->getValue(sprintf($sql, $customer->id))) {
$sql = 'SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 AND id_customer != ' . (int) $customer->id . ' GROUP BY id_customer HAVING SUM(total_paid_real) > %d';
Db::getInstance()->getValue(sprintf($sql, (int) $total_customer));
$count_better_customers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
} else {
$count_better_customers = '-';
}
$orders = Order::getCustomerOrders($customer->id, true);
$total_orders = count($orders);
for ($i = 0; $i < $total_orders; $i++) {
$orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
$orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int) $orders[$i]['id_currency']));
}
$messages = CustomerThread::getCustomerMessages((int) $customer->id);
$total_messages = count($messages);
for ($i = 0; $i < $total_messages; $i++) {
$messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
$messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
if (isset(self::$meaning_status[$messages[$i]['status']])) {
$messages[$i]['status'] = self::$meaning_status[$messages[$i]['status']];
}
}
$groups = $customer->getGroups();
$total_groups = count($groups);
for ($i = 0; $i < $total_groups; $i++) {
$group = new Group($groups[$i]);
$groups[$i] = array();
$groups[$i]['id_group'] = $group->id;
$groups[$i]['name'] = $group->name[$this->default_form_language];
}
$total_ok = 0;
$orders_ok = array();
$orders_ko = array();
foreach ($orders as $order) {
if (!isset($order['order_state'])) {
$order['order_state'] = $this->l('There is no status defined for this order.');
}
if ($order['valid']) {
$orders_ok[] = $order;
$total_ok += $order['total_paid_real_not_formated'];
} else {
$orders_ko[] = $order;
}
}
$products = $customer->getBoughtProducts();
$carts = Cart::getCustomerCarts($customer->id);
$total_carts = count($carts);
for ($i = 0; $i < $total_carts; $i++) {
$cart = new Cart((int) $carts[$i]['id_cart']);
$this->context->cart = $cart;
$summary = $cart->getSummaryDetails();
$currency = new Currency((int) $carts[$i]['id_currency']);
$carrier = new Carrier((int) $carts[$i]['id_carrier']);
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
$carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
$carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
$carts[$i]['name'] = $carrier->name;
}
$sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
FROM ' . _DB_PREFIX_ . 'cart_product cp
JOIN ' . _DB_PREFIX_ . 'cart c ON (c.id_cart = cp.id_cart)
JOIN ' . _DB_PREFIX_ . 'product p ON (cp.id_product = p.id_product)
WHERE c.id_customer = ' . (int) $customer->id . '
AND NOT EXISTS (
SELECT 1
FROM ' . _DB_PREFIX_ . 'orders o
JOIN ' . _DB_PREFIX_ . 'order_detail od ON (o.id_order = od.id_order)
WHERE product_id = cp.id_product AND o.valid = 1 AND o.id_customer = ' . (int) $customer->id . '
)';
$interested = Db::getInstance()->executeS($sql);
$total_interested = count($interested);
for ($i = 0; $i < $total_interested; $i++) {
$product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']);
if (!Validate::isLoadedObject($product)) {
continue;
}
$interested[$i]['url'] = $this->context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $this->default_form_language), null, null, $interested[$i]['cp_id_shop']);
$interested[$i]['id'] = (int) $product->id;
$interested[$i]['name'] = Tools::htmlentitiesUTF8($product->name);
}
$emails = $customer->getLastEmails();
$connections = $customer->getLastConnections();
if (!is_array($connections)) {
$connections = array();
}
$total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++) {
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
}
//.........这里部分代码省略.........
开发者ID:nmardones,项目名称:PrestaShop,代码行数:101,代码来源:AdminCustomersController.php
示例18: initContent
public function initContent()
{
$internal_referrer = isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], Dispatcher::getInstance()->createUrl('order-opc', $this->context->cookie->id_lang));
$upsell = @Module::getInstanceByName('upsell');
if ($upsell && $upsell->active && !(Tools::getValue('skip_offers') == 1 || $internal_referrer)) {
ParentOrderController::initContent();
// We need this to display the page properly (parent of overriden controller)
$upsell->getUpsells();
$this->template = $upsell->setTemplate('upsell-products.tpl');
} else {
if (!$this->isOpcModuleActive()) {
return parent::initContent();
}
$this->origInitContent();
$this->_assignSummaryInformations();
$this->_assignWrappingAndTOS();
$selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule) {
if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
$free_shipping = true;
break;
}
}
$this->context->smarty
|
请发表评论