本文整理汇总了PHP中Gender类的典型用法代码示例。如果您正苦于以下问题:PHP Gender类的具体用法?PHP Gender怎么用?PHP Gender使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($pesel)
{
$gender = new Gender($pesel);
$gender->printOut();
$birth = new Birth($pesel);
$birth->printOut();
}
示例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'));
}
示例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;
}
示例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');
}
示例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);
}
示例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;
}
示例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);
}
示例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');
}
示例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()));
示例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));
}
}
}
示例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;
}
示例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');
}
示例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));
}
}
示例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");
示例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');
}