public function deletePromo() { $msg = ""; $id = $_GET['id']; $promotion = new Promotion(); if ($promotion->access_ModelMember_sessionExists() || $promotion->access_ModelMember_userAdmin()) { $promotion->setIdPromo($id); // GERER LES CONSEQUENCES D'UNE SUPPRESSION SUR LES PRODUITS QUI ONT CE CODE PROMO $delPromo = $promotion->deletePromo(); $msg .= 'Code promo supprimé !'; } else { $msg .= 'Vous n\'avez pas le droit d\'accéder à cette page'; } include "views/promos/deletePromo.php"; }
public function show($id) { $student = Issue::with('placements', 'placement', 'receivable.installments', 'educations', 'education', 'earnings', 'punishments', 'returnments', 'presences', 'points', 'retrievals', 'timelines', 'masteries')->find($id); $periods = Teach::with(array('presences' => function ($q) use($id) { $q->where('issue_id', '=', $id); }))->select(DB::raw('month(course_date) as months'), DB::raw('year(course_date) as years'))->groupBy(DB::raw('month(course_date)'))->get(); $presences = array(); foreach ($periods as $period) { $presences[] = array('month' => $period->months, 'year' => $period->years, 'presences' => $this->countPresences($id, $period->months, $period->years), 'presents' => $this->countPresents($id, $period->months, $period->years), 'absents' => $this->countAbsents($id, $period->months, $period->years), 'sicks' => $this->countSicks($id, $period->months, $period->years), 'permits' => $this->countPermits($id, $period->months, $period->years)); } $points = array(); foreach ($student->points as $point) { if ($point->pointable_type == 'Activity') { $points[] = array('date' => $point->pointable->agenda, 'event' => $point->pointable->name, 'point' => $point->point, 'lowest' => $this->getLowest($point->pointable_id), 'highest' => $this->getHighest($point->pointable_id)); } } $handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $student->generation_id)->get(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $discounts = Discount::all(); $promotions = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); $vouchers = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get(); $charges = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get(); $menu = 'student'; return View::make('students.show', compact('student', 'handbooks', 'courses', 'discounts', 'promotions', 'vouchers', 'charges', 'presences', 'points', 'menu')); }
public function process() { parent::process(); //echo "vao day";die; if (self::$cookie->RoleID == 1) { Tools::redirect('hotelpage.php?mid=' . self::$cookie->HotelID); } $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID); $search_form = array(); $search_form['CityId'] = 0; $search_form['AreaId'] = 0; if ((self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) && self::$cookie->OldLoginUserName == NULL) { $search_form['CheckIn'] = date('Y-m-d', strtotime(date('Y-m-d') . " + 5 days")); $search_form['Nights'] = 1; $search_form['CheckOut'] = date('Y-m-d', strtotime($search_form['CheckIn'] . " + {$search_form['Nights']} days")); } $search_form['HotelClassId'] = 0; $search_form['HotelName'] = ''; $search_form['ContinentCode'] = $continentCode; $roomtype_list = RoomPlan::getRoomTypeList(); $roomtype_form_list = array(); foreach ($roomtype_list as $roomtype) { $roomTypeId = $roomtype['RoomTypeId']; $roomtype_form_list[$roomTypeId] = 0; } $search_form['RoomTypeVals'] = $roomtype_form_list; self::$smarty->assign("roomTypeList", $roomtype_list); self::$smarty->assign("search_form", $search_form); self::$smarty->assign("classList", Tools::getAllHotelClasses()); self::$smarty->assign("areaList", Tools::getJapanAreas()); //get Hotel List and Promotion List $promotionList = Promotion::getHomePromotionList(Promotion::$TYPE_PROMOTION); self::$smarty->assign('homePromotionList', $promotionList); $eventList = Promotion::getHomePromotionList(Promotion::$TYPE_EVENT); self::$smarty->assign('homeEventList', $eventList); // Get Popular Hotel List $poList = HotelDetail::getPopularHotelList(3); // 東京・横浜 - 関東 areaid = 3 $popularList = array(); global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); foreach ($poList as $popular) { $image = HotelDetail::getFirstFileOfHotel($popular['HotelId'], 150, 150); if (is_file(_TAS_ROOT_DIR_ . "/asset/" . $image['w5_path'])) { $popular['HotelFilePath'] = $image['w5_path']; $popular['w5'] = $image['w5']; $popular['h5'] = $image['h5']; } $popular['LowestPrice'] = HotelDetail::getLowestPriceOfHotel($popular['HotelId']); $popular['AreaName'] = HotelDetail::getAreaName($popular['HotelArea']); $HotelNameKey = 'HotelName_' . $iso; $popular['HotelName'] = $popular[$HotelNameKey]; $popularList[] = $popular; } //self::$smarty->assign('homeAreaList', Db::getInstance()->ExecuteS("select *, AreaName_".$this->iso." as AreaName from HT_Area where AreaId in (3, 5, 8, 12)")); self::$smarty->assign('homeAreaList', Db::getInstance()->ExecuteS('select *, AreaName_' . $this->iso . ' as AreaName from `HT_Area` where isPopular = 1')); self::$smarty->assign("popularList", $popularList); }
/** * Returns a promotion bean for the * given scope and id with the following populated values * title, next start time as date, id, primary genre as genre, * summary, gallery id as image and schedule note * * @param String scope * @param int oid of the event * @return Promotion bean */ function getPromotion($scope, $id) { global $logger; $logger->debug(get_class($this) . "::getPromotion({$scope}, {$id})"); $db =& JFactory::getDBO(); // Program or Exhibition differences if ($scope == 'Program') { $query = 'SELECT distinct e.eoid as id, "Program" as scope, e.title,' . ' e.gallery as image, e.summary, e.scheduleNote,' . ' s.startTime as start, s.endTime as end ' . ' FROM Program as e, Schedule as s, _ez_relation_ as r' . ' WHERE s.eoid = r.oid_b ' . ' AND r.class_b = "Schedule"' . ' AND r.oid_a IN ( ' . ' SELECT distinct r1.oid_b ' . ' FROM _ez_relation_ as r1 ' . ' WHERE oid_a = ' . $id . ' AND class_a="Program"' . ' AND class_b="Performance"' . ' ) AND e.eoid =' . $id . ' ORDER BY s.startTime'; } else { $query = 'SELECT distinct e.eoid as id, "Exhibition" as scope, e.title, ' . ' e.gallery as image, e.summary, e.scheduleNote, ' . ' s.startTime as start, s.endTime as end ' . ' FROM Exhibition as e, Schedule as s, _ez_relation_ as r' . ' WHERE s.eoid = r.oid_b ' . ' AND r.class_b = "Schedule"' . ' AND r.class_a = "Exhibition"' . ' AND r.oid_a = e.eoid' . ' AND e.eoid = ' . $id . ' ORDER BY s.startTime'; } $db->setQuery($query); $rows = $db->loadAssocList(); $promo = new Promotion($rows[0]); // get the promotion date // in Programs it is the next performance (or the most recent if no next) // in Exhibitions it is the start date if future or end date if start date past $date = null; foreach ($rows as $row) { if ($scope == "Exhibition") { $date = $row['end']; if ($row['start'] > time()) { $date = $row['start']; } } else { $date = $row['start']; if ($date > time()) { break; } } } $promo->setDate($date); // now get the primary genre information $query = 'SELECT DISTINCT c.eoid as oid, c.name FROM Category as c, _ez_relation_ as r WHERE c.eoid = r.oid_b AND r.var_a = "primaryGenre" AND r.oid_a = ' . $promo->getId(); $db->setQuery($query); $pg = new Genre($db->loadAssoc()); $promo->setPrimaryGenre($pg); return $promo; }
public function destroy($id) { $promotion = Promotion::with('reductions')->find($id); if ($promotion->reductions->count() > 0) { Session::flash('message', 'Tidak dapat menghapus promo! Promo ini pernah digunakan!'); } else { Promotion::destroy($id); Session::flash('message', 'Sukses menghapus promo'); } }
public function preProcess() { //parent::preProcess(); $id = Tools::getValue('PromotionId'); if ($id == '0' || Tools::isEmpty($id)) { exit; } $promotion = new Promotion(); $promotion->getById($id); //promotion list navigation $navi_url = "promotionlist.php?type=" . $promotion->Type; $navi_name = $promotion->Type == Promotion::$TYPE_PROMOTION ? 'Promotion List' : 'Event List'; $this->brandNavi[] = array("name" => $navi_name, "url" => $navi_url); //promotoin detail navigation $navi_url = $this->php_self . "?PromotionId=" . $id; $navi_name = $promotion->Title; $this->brandNavi[] = array("name" => $promotion->Title, "url" => $navi_url, "nolang" => 1); $fields = $promotion->getAsArray(); $fields['Content'] = urldecode($fields['Content']); self::$smarty->assign("data", $fields); }
public function create() { $menu = 'registration'; $generations = Generation::all(); $classifications = Classification::where('category', '=', 'Registration')->get(); $locations = Location::where('id', '<>', Auth::user()->location_id)->get(); $employees = Employee::all(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->where('active', '=', 1)->get(); $discounts = Discount::all(); $promotions = Promotion::all(); $vouchers = Voucher::all(); $charges = Charge::all(); $partners = Partner::where('location_id', '=', Auth::user()->location_id)->get(); return View::make('registrations.create', compact('classifications', 'locations', 'employees', 'generations', 'courses', 'charges', 'discounts', 'promotions', 'vouchers', 'partners', 'menu')); }
public function actionPromotion($id = false) { $this->menu = Category::model()->findAll(); $this->pageTitle = 'Мобильный мир - акции'; if ($id) { $model = Promotion::model()->findByPk($id); $this->render('promotion', array('model' => $model)); } else { $criteria = new CDbCriteria(); $criteria->order = 'id ASC'; $count = Promotion::model()->count($criteria); $pages = new CPagination($count); $pages->pageSize = 2; $pages->applyLimit($criteria); $model = Promotion::model()->findAll($criteria); $this->render('allPromotion', array('model' => $model, 'pages' => $pages)); } }
public function checkpromotionAction() { $code = $this->getRequest()->getParam('code'); $room_id = $this->getRequest()->getParam('room_id'); $index = $this->getRequest()->getParam('index'); $response['code'] = 'ERROR'; $booking = self::getBooking(); if ($room_id === 'hotel') { $Promotion = Promotion::checkPromotion($code, $booking['hotels_id'], date('Y-m-d'), 'hotel'); if ($Promotion) { $booking['payment']['promo_hotel'] = $Promotion->price; $response['code'] = 'SUCCESS'; } else { $booking['payment']['promo_hotel'] = 0; } } else { if (array_key_exists($room_id, $booking['rooms'])) { $Promotion = Promotion::checkPromotion($code, $room_id, date('Y-m-d')); if ($Promotion) { $booking['rooms'][$room_id][$index]['promotion_id'] = $Promotion->id; $booking['rooms'][$room_id][$index]['discount'] = $Promotion->price; $discount = 0; foreach ($booking['rooms'] as $rooms) { foreach ($rooms as $room) { $discount = $discount + $room['discount']; } } $booking['payment']['promo_price'] = $discount; $response['code'] = 'SUCCESS'; } } } $booking['payment']['grand_total'] = $booking['payment']['total_price'] - (int) $booking['payment']['promo_price'] - (int) $booking['payment']['promo_hotel'] + $booking['payment']['payment_fee_price']; $this->setBooking($booking); echo json_encode($response); }
/** * Interface processor for the promotions list manager * * @return void **/ function promotions () { global $Ecart; $db = DB::get(); if ( !(is_ecart_userlevel() || current_user_can('ecart_promotions')) ) wp_die(__('You do not have sufficient permissions to access this page.')); require_once("{$Ecart->path}/core/model/Promotion.php"); $defaults = array( 'page' => false, 'deleting' => false, 'delete' => false, 'pagenum' => 1, 'per_page' => 20, 's' => '' ); $args = array_merge($defaults,$_GET); extract($args,EXTR_SKIP); if ($page == "ecart-promotions" && !empty($deleting) && !empty($delete) && is_array($delete)) { foreach($delete as $deletion) { $Promotion = new Promotion($deletion); $Promotion->delete(); } } if (!empty($_POST['save'])) { check_admin_referer('ecart-save-promotion'); if ($_POST['id'] != "new") { $Promotion = new Promotion($_POST['id']); } else $Promotion = new Promotion(); if (!empty($_POST['starts']['month']) && !empty($_POST['starts']['date']) && !empty($_POST['starts']['year'])) $_POST['starts'] = mktime(0,0,0,$_POST['starts']['month'],$_POST['starts']['date'],$_POST['starts']['year']); else $_POST['starts'] = 1; if (!empty($_POST['ends']['month']) && !empty($_POST['ends']['date']) && !empty($_POST['ends']['year'])) $_POST['ends'] = mktime(23,59,59,$_POST['ends']['month'],$_POST['ends']['date'],$_POST['ends']['year']); else $_POST['ends'] = 1; if (isset($_POST['rules'])) $_POST['rules'] = stripslashes_deep($_POST['rules']); $Promotion->updates($_POST); $Promotion->save(); do_action_ref_array('ecart_promo_saved',array(&$Promotion)); $Promotion->reset_discounts(); if ($Promotion->target == "Catalog") $Promotion->build_discounts(); // Force reload of the session promotions to include any updates $Ecart->Promotions->reload(); } $pagenum = absint( $pagenum ); if ( empty($pagenum) ) $pagenum = 1; if( !$per_page || $per_page < 0 ) $per_page = 20; $start = ($per_page * ($pagenum-1)); $where = ""; if (!empty($s)) $where = "WHERE name LIKE '%$s%'"; $table = DatabaseObject::tablename(Promotion::$table); $promocount = $db->query("SELECT count(*) as total FROM $table $where"); $Promotions = $db->query("SELECT * FROM $table $where",AS_ARRAY); $status = array( 'enabled' => __('Enabled','Ecart'), 'disabled' => __('Disabled','Ecart') ); $num_pages = ceil($promocount->total / $per_page); $page_links = paginate_links( array( 'base' => add_query_arg( 'pagenum', '%#%' ), 'format' => '', 'total' => $num_pages, 'current' => $pagenum )); include("{$Ecart->path}/core/ui/promotions/promotions.php"); }
origin.options[i]=null; i = i-1; } } } function validate_filter() { document.formulaire.add_type.value = \'' . $add_type . '\'; document.formulaire.form_sent.value=0; document.formulaire.submit(); } </script>'; $form_sent = 0; $errorMsg = ''; $users = $sessions = array(); $promotion = new Promotion(); $id = intval($_GET['id']); if (isset($_POST['form_sent']) && $_POST['form_sent']) { $form_sent = $_POST['form_sent']; $session_in_promotion_posted = $_POST['session_in_promotion_name']; if (!is_array($session_in_promotion_posted)) { $session_in_promotion_posted = array(); } if ($form_sent == 1) { // Added a parameter to send emails when registering a user SessionManager::suscribe_sessions_to_promotion($id, $session_in_promotion_posted); header('Location: promotions.php'); exit; } } $promotion_data = $promotion->get($id);
function promotions_list() { global $Shopp; $db = DB::get(); if (!current_user_can(SHOPP_USERLEVEL)) { wp_die(__('You do not have sufficient permissions to access this page.')); } require_once "{$this->basepath}/core/model/Promotion.php"; $defaults = array('page' => false, 'deleting' => false, 'delete' => false, 'pagenum' => 1, 'per_page' => 20, 's' => ''); $args = array_merge($defaults, $_GET); extract($args, EXTR_SKIP); if ($page == "shopp-promotions" && !empty($deleting) && !empty($delete) && is_array($delete)) { foreach ($delete as $deletion) { $Promotion = new Promotion($deletion); $Promotion->delete(); } } if (!empty($_POST['save'])) { check_admin_referer('shopp-save-promotion'); if ($_POST['id'] != "new") { $Promotion = new Promotion($_POST['id']); } else { $Promotion = new Promotion(); } if (!empty($_POST['starts']['month']) && !empty($_POST['starts']['date']) && !empty($_POST['starts']['year'])) { $_POST['starts'] = mktime(0, 0, 0, $_POST['starts']['month'], $_POST['starts']['date'], $_POST['starts']['year']); } else { $_POST['starts'] = 1; } if (!empty($_POST['ends']['month']) && !empty($_POST['ends']['date']) && !empty($_POST['ends']['year'])) { $_POST['ends'] = mktime(23, 59, 59, $_POST['ends']['month'], $_POST['ends']['date'], $_POST['ends']['year']); } else { $_POST['ends'] = 1; } if (isset($_POST['rules'])) { $_POST['rules'] = stripslashes_deep($_POST['rules']); } $Promotion->updates($_POST); $Promotion->save(); do_action_ref_array('shopp_promo_saved', array(&$Promotion)); if ($Promotion->scope == "Catalog") { $Promotion->build_discounts(); } // Reset cart promotions cache // to force reload for these updates $Shopp->Cart->data->Promotions = false; } $pagenum = absint($pagenum); if (empty($pagenum)) { $pagenum = 1; } if (!$per_page || $per_page < 0) { $per_page = 20; } $start = $per_page * ($pagenum - 1); $where = ""; if (!empty($s)) { $where = "WHERE name LIKE '%{$s}%'"; } $table = DatabaseObject::tablename(Promotion::$table); $promocount = $db->query("SELECT count(*) as total FROM {$table} {$where}"); $Promotions = $db->query("SELECT * FROM {$table} {$where}", AS_ARRAY); $status = array('enabled' => __('Enabled', 'Shopp'), 'disabled' => __('Disabled', 'Shopp')); $num_pages = ceil($promocount->total / $per_page); $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'total' => $num_pages, 'current' => $pagenum)); include "{$this->basepath}/core/ui/promotions/promotions.php"; }
/** * Generates a Purchase record from the order * * @since 1.1 * * @return void **/ function purchase () { global $Ecart; // Need a transaction ID to create a purchase if (empty($this->txnid)) return false; // Lock for concurrency protection $this->lock(); $Purchase = new Purchase($this->txnid,'txnid'); if (!empty($Purchase->id)) { $this->unlock(); $Ecart->resession(); $this->purchase = $Purchase->id; if ($this->purchase !== false) ecart_redirect(ecarturl(false,'thanks')); } // WordPress account integration used, customer has no wp user if ("wordpress" == $this->accounts && empty($this->Customer->wpuser)) { if ( $wpuser = get_current_user_id() ) $this->Customer->wpuser = $wpuser; // use logged in WordPress account else $this->Customer->create_wpuser(); // not logged in, create new account } // New customer, save hashed password if (!$this->Customer->exists() && !empty($this->Customer->password)) { $this->Customer->id = false; if (ECART_DEBUG) new EcartError('Creating new Ecart customer record','new_customer',ECART_DEBUG_ERR); if ("ecart" == $this->accounts) $this->Customer->notification(); $this->Customer->password = wp_hash_password($this->Customer->password); } else unset($this->Customer->password); // Existing customer, do not overwrite password field! $this->Customer->save(); $this->Billing->customer = $this->Customer->id; $this->Billing->card = substr($this->Billing->card,-4); $paycard = Lookup::paycard($this->Billing->cardtype); $this->Billing->cardtype = !$paycard?$this->Billing->cardtype:$paycard->name; $this->Billing->cvv = false; $this->Billing->save(); // Card data is truncated, switch the cart to normal mode $Ecart->Shopping->secured(false); if (!empty($this->Shipping->address)) { $this->Shipping->customer = $this->Customer->id; $this->Shipping->save(); } $base = $Ecart->Settings->get('base_operations'); $promos = array(); foreach ($this->Cart->discounts as &$promo) { $promos[$promo->id] = $promo->name; $promo->uses++; } $Purchase = new Purchase(); $Purchase->copydata($this); $Purchase->copydata($this->Customer); $Purchase->copydata($this->Billing); $Purchase->copydata($this->Shipping,'ship'); $Purchase->copydata($this->Cart->Totals); $Purchase->customer = $this->Customer->id; $Purchase->billing = $this->Billing->id; $Purchase->shipping = $this->Shipping->id; $Purchase->taxing = ($base['vat'])?'inclusive':'exclusive'; $Purchase->promos = $promos; $Purchase->freight = $this->Cart->Totals->shipping; $Purchase->ip = $Ecart->Shopping->ip; $Purchase->save(); $this->unlock(); Promotion::used(array_keys($promos)); foreach($this->Cart->contents as $Item) { $Purchased = new Purchased(); $Purchased->copydata($Item); $Purchased->price = $Item->option->id; $Purchased->purchase = $Purchase->id; if (!empty($Purchased->download)) $Purchased->keygen(); $Purchased->save(); if ($Item->inventory) $Item->unstock(); } $this->purchase = $Purchase->id; $Ecart->Purchase = &$Purchase; if (ECART_DEBUG) new EcartError('Purchase '.$Purchase->id.' was successfully saved to the database.',false,ECART_DEBUG_ERR); do_action('ecart_order_notifications'); do_action_ref_array('ecart_order_success',array(&$Ecart->Purchase)); }
<?php if (isset($_GET['id']) && !empty($_GET['id'])) { $id = htmlentities($_GET['id']); $promotion = Promotion::getPromotionById($id); if (isset($_POST['edit'])) { if (preg_match("#^([0-9]{1,2}|100)\$#", $_POST['percent'])) { PDOConnexion::setParameters('phonedeals', 'root', 'root'); $db = PDOConnexion::getInstance(); $sql = "\n\t\t\t\tUPDATE promotion\n\t\t\t\tSET percent = :percent\n\t\t\t\tWHERE id = :id\n\t\t\t"; $sth = $db->prepare($sql); $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Promotion'); $sth->execute(array(':id' => $id, ':percent' => $_POST['percent'])); if ($sth) { App::success('La promotion a bien été modifiée'); } } else { App::error("Les champs ne sont pas valides"); } } if ($member) { ?> <div class="col-md-8"> <div class="page-header"> <h1>Éditer une promotion</h1> </div> <form action="index.php?page=admin/promotion-edit&id=<?php echo $id; ?> " method="POST">
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $promotions = Promotion::getList('SELECT * FROM session'); $sessions = array(); foreach ($promotions as $key => $session) { //$session_date_label = ucfirst(Lang::_(strtolower(date('F', strtotime($session->date_start))))).' '.date('Y', strtotime($session->date_start)).' - '.ucfirst(Lang::_(strtolower(date('F', strtotime($session->date_end))))).' '.date('Y', strtotime($session->date_end)); $session_date_label = $session->label; $sessions[] = array('id' => $session->id, 'name' => $session_date_label); } $genders = array(array('id' => 1, 'name' => 'Homme'), array('id' => 0, 'name' => 'Femme')); $session_id = $request->get('promo', $this->_getfieldvalue('session_id', $type, $request)); $form = new Form('form-post-' . $type, 'form-post-' . $type, $action, 'POST', 'form-horizontal', $errors, $isPost); $form->addField('session_id', Lang::_('Session'), 'select', $session_id, true, '', @$errors['session_id'], null, null, $sessions, $type == 'update' ? true : false); $form->addField('firstname', Lang::_('Firstname'), 'text', $this->_getfieldvalue('firstname', $type, $request), true, '', @$errors['firstname']); $form->addField('lastname', Lang::_('Lastname'), 'text', $this->_getfieldvalue('lastname', $type, $request), true, '', @$errors['lastname']); $form->addField('gender', Lang::_('Gender'), 'select', $this->_getfieldvalue('gender', $type, $request), true, '', @$errors['gender'], null, null, $genders); /*$form->addField('photo', Lang::_('Photo'), 'file', $this->_getfieldvalue('photo', $type, $request), false, '', @$errors['photo']);*/ $form->addField('photo', Lang::_('Photo'), 'filecrop', $this->_getfieldvalue('photo', $type, $request), false, '', @$errors['photo']); $form->addField('date_birth', Lang::_('Date de naissance'), 'date', $this->_getfieldvalue('date_birth', $type, $request), true, '', @$errors['date_birth']); $form->addField('num_pe', Lang::_('Numero Pole Emploi'), 'text', $this->_getfieldvalue('num_pe', $type, $request), true, '', @$errors['num_pe']); $form->addField('from_city', Lang::_('From_city'), 'text', $this->_getfieldvalue('from_city', $type, $request), true, '', @$errors['from_city']); $form->addField('email', Lang::_('Email'), 'email', $this->_getfieldvalue('email', $type, $request), false, '', @$errors['email']); $form->addField('phone', Lang::_('Phone'), 'text', $this->_getfieldvalue('phone', $type, $request), false, '', @$errors['phone']); return $form; }
public function access_ModelPromotion_FindOne($id) { include_once "models/promotion.php"; $promo = new Promotion(); $promo->setIdPromo($id); $resultat = $promo->findPromo(); return $resultat; }
public function access_ModelPromo_listPromo() { include_once 'models/promotion.php'; $promo = new Promotion(); $resultat = $promo->listPromo(); return $resultat; }
echo '<a href="' . $newurl . '&capacity=' . $capacity->storage . '" class="list-group-item' . $active . '">' . $capacity->storage . ' Go</a>'; } ?> </div> </div> </div> <?php if (!isset($_GET['p']) || $_GET['p'] < $totalPages + 1) { ?> <div class="col-md-9"> <div class="row"> <?php foreach ($phoneRequest as $phone) { if (Promotion::getPromotionByPhoneId($phone->id)) { $phone->promotionPrice = $phone->price - Promotion::getPromotionByPhoneId($phone->id)->percent * 0.01 * $phone->price; } echo '<div class="col-md-4 col-sm-6 col-xs-12" style="text-align: center">'; echo '<div style="border: 1px solid #ededed; padding: 30px; margin: 20px 0;">'; echo '<a href="index.php?page=product&id=' . $phone->id . '">'; echo '<img src="' . Phone::getPhoneThumbnail($phone->id) . '" alt="' . $phone->name . '" style="width: 100px;">'; echo '<h4>' . $phone->name . '</h4>'; echo '</a>'; if (isset($phone->promotionPrice)) { echo '<span class="badge old-price" style="background-color: transparent; height: 18px; color: #777;">' . number_format($phone->price, 2, ',', ' ') . ' €</span> <span class="badge" style="background: #e74c3c;">' . $phone->promotionPrice . ' €</span>'; } else { echo '<span class="badge">' . number_format($phone->price, 2, ',', ' ') . ' €</span>'; } echo '</div>'; echo '</div>'; }
public function process() { parent::process(); $type = $this->type; $swhere = parent::getSearchWhere(); //if not admin, add date condition /* if(self::$cookie -> RoleID <= 3 ){ $swhere.= ($swhere=='')?'':" AND "; $swhere.= " (CURDATE() BETWEEN A.`StaDate` AND A.`EndDate`) "; }*/ $promotionCount = Promotion::getPromotionCount($type, $swhere); $this->pagination($promotionCount); $promotionList = Promotion::getPromotionList($type, $swhere, $this->p, $this->n); self::$smarty->assign("listData", $promotionList); self::$smarty->assign("areaList", Tools::getJapanAreas()); self::$smarty->assign("count", $promotionCount); }
/** * @return \yii\db\ActiveQuery */ public function getPromotions() { return $this->hasMany(Promotion::className(), ['user_id' => 'id']); }
/** * Copies the career to a new one * @param integer Career ID * @param boolean Whether or not to copy the promotions inside * @return integer New career ID on success, false on failure */ public function copy($id, $copy_promotions = false) { $career = $this->get($id); $new = array(); foreach ($career as $key => $val) { switch ($key) { case 'id': case 'updated_at': break; case 'name': $val .= ' ' . get_lang('CopyLabelSuffix'); $new[$key] = $val; break; case 'created_at': $val = api_get_utc_datetime(); $new[$key] = $val; break; default: $new[$key] = $val; break; } } $cid = $this->save($new); if ($copy_promotions) { //Now also copy each session of the promotion as a new session and register it inside the promotion $promotion = new Promotion(); $promo_list = $promotion->get_all_promotions_by_career_id($id); if (!empty($promo_list)) { foreach ($promo_list as $item) { $pid = $promotion->copy($item['id'], $cid); } } } return $cid; }
<?php define('PUBLIC_ROOT', dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))); define('ROOT', dirname(PUBLIC_ROOT)); define('DS', DIRECTORY_SEPARATOR); define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME']))); define('DOMAIN', $_SERVER['HTTP_HOST']); define('PROTOCOLE', isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ? 'https' : 'http'); define('SYSTEM', ROOT . DS . 'system'); define('APP', ROOT . DS . 'app'); define('LANG', ROOT . DS . 'ressources' . DS . 'lang'); session_start(); require_once APP . '/model/PDOConnexion.php'; require_once APP . '/model/App.class.php'; require_once APP . '/model/Promotion.class.php'; require_once APP . '/model/Phone.class.php'; header('Content-Type: application/json'); if (isset($_POST['delete']) && isset($_POST['id']) && App::isAdmin()) { Promotion::deletePromotion(htmlentities($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } echo json_encode(array_merge($_POST, array('status' => 'unknown error'))); die;
break; case 'get_gradebooks': require_once $libpath . 'gradebook.lib.php'; $obj = new Gradebook(); $count = $obj->get_count(); break; case 'get_event_email_template': $obj = new EventEmailTemplate(); $count = $obj->get_count(); break; case 'get_careers': $obj = new Career(); $count = $obj->get_count(); break; case 'get_promotions': $obj = new Promotion(); $count = $obj->get_count(); break; case 'get_grade_models': $obj = new GradeModel(); $count = $obj->get_count(); break; case 'get_usergroups': $obj = new UserGroup(); $count = $obj->get_count(); break; case 'get_usergroups_teacher': $obj = new UserGroup(); $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'registered'; $groupFilter = isset($_REQUEST['group_filter']) ? intval($_REQUEST['group_filter']) : 0; $course_id = api_get_course_int_id();
* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file htdocs/boutique/promotion/index.php * \ingroup boutique * \brief Page gestion promotions OSCommerce */ require "../../main.inc.php"; require_once DOL_DOCUMENT_ROOT . '/boutique/osc_master.inc.php'; llxHeader(); if ($action == "inactive") { $promotion = new Promotion($dbosc); $promotion->set_inactive($id); } if ($action == "active") { $promotion = new Promotion($dbosc); $promotion->set_active($id); } if ($sortfield == "") { $sortfield = "pd.products_name"; } if ($sortorder == "") { $sortorder = "ASC"; } if ($page == -1) { $page = 0; } $limit = $conf->liste_limit; $offset = $limit * $page; print_barre_liste("Liste des promotions", $page, "index.php", "", $sortfield, $sortorder); $urladd = "&sortorder={$sortorder}&sortfield={$sortfield}";
<?php require_once './classes/Promotion.php'; $pm = new Promotion(); $data = $_POST['data']; $enrolled_users = $_POST['enrolled_users']; $workshop_users = $_POST['workshop_users']; $list = $pm->add_new_campaign($data, $enrolled_users, $workshop_users); echo $list;
$extra_params['height'] = 'auto'; //use the width of the parent //With this function we can add actions to the jgrid $action_links = 'function action_formatter (cellvalue, options, rowObject) { return \'<a href="add_sessions_to_promotion.php?id=\'+options.rowId+\'">' . Display::return_icon('session_to_promotion.png', get_lang('SubscribeSessionsToPromotions'), '', ICON_SIZE_SMALL) . '</a>' . ' <a href="?action=edit&id=\'+options.rowId+\'">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>' . ' <a onclick="javascript:if(!confirm(' . "\\'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES)) . "\\'" . ')) return false;" href="?sec_token=' . $token . '&action=copy&id=\'+options.rowId+\'">' . Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL) . '</a>' . ' <a onclick="javascript:if(!confirm(' . "\\'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES)) . "\\'" . ')) return false;" href="?sec_token=' . $token . '&action=delete&id=\'+options.rowId+\'">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a> \'; }'; ?> <script> $(function() { <?php echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); ?> }); </script> <?php $promotion = new Promotion(); switch ($action) { case 'add': if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } //First you need to create a Career $career = new Career(); $careers = $career->get_all(); if (empty($careers)) { $url = Display::url(get_lang('YouNeedToCreateACareerFirst'), 'careers.php?action=add'); Display::display_normal_message($url, false); Display::display_footer(); exit; } $url = api_get_self() . '?action=' . Security::remove_XSS($_GET['action']);
// action links echo '<div class="actions" style="margin-bottom:20px">'; echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '<a href="careers.php">' . Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '<a href="promotions.php">' . Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; $form->display(); $careers = $career->get_all($condition); //only status =1 $column_count = 3; $i = 0; $grid_js = ''; $career_array = array(); if (!empty($careers)) { foreach ($careers as $career_item) { $promotion = new Promotion(); // Getting all promotions $promotions = $promotion->get_all_promotions_by_career_id($career_item['id'], 'name DESC'); $career_content = ''; $promotion_array = array(); if (!empty($promotions)) { foreach ($promotions as $promotion_item) { if (!$promotion_item['status']) { continue; //avoid status = 0 } // Getting all sessions from this promotion $sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']); $session_list = array(); foreach ($sessions as $session_item) { $course_list = SessionManager::get_course_list_by_session_id($session_item['id']);
/** * Matches a Promo Code rule to a code submitted from the shopping cart * * @since 1.1 * * @param array $rule The promo code rule * @return boolean **/ function promocode ($rule) { extract($rule); $promocode = strtolower($value); // Match previously applied codes if (isset($this->Cart->promocodes[$promocode]) && is_array($this->Cart->promocodes[$promocode])) return true; // Match new codes // No code provided, nothing will match if (empty($this->Cart->promocode)) return false; $subject = strtolower($this->Cart->promocode); return Promotion::match_rule($subject,$logic,$promocode,$property); }
/** * Match a rule to the item * * @since 1.1 * * @param array $rule A structured rule array * @return boolean **/ function match ($rule) { extract($rule); switch($property) { case "Any item name": $subject = $this->name; break; case "Any item quantity": $subject = (int)$this->quantity; break; case "Any item amount": $subject = $this->total; break; case "Name": $subject = $this->name; break; case "Category": $subject = $this->categories; break; case "Tag name": $subject = $this->tags; break; case "Variation": $subject = $this->option->label; break; // case "Input name": $subject = $Item->option->label; break; // case "Input value": $subject = $Item->option->label; break; case "Quantity": $subject = $this->quantity; break; case "Unit price": $subject = $this->unitprice; break; case "Total price": $subject = $this->total; break; case "Discount amount": $subject = $this->discount; break; } return Promotion::match_rule($subject,$logic,$value,$property); }
<?php session_start(); include "../pdoconnection.php"; include "../connection.php"; include "../Class/Promotion.php"; include "../Class/Room.php"; if (isset($_POST['addpromo'])) { $promoroom = new Promotion(); $Roomid = $_POST['roomid']; $Promoname = $_POST['promoname']; $Promorate = $_POST['promorate']; $Discount = $_POST['discount']; $Descript = $_POST['descript']; $Status = $_POST['status']; $Start = $_POST['start']; $End = $_POST['end']; //$Numberofdays=$_POST['numberofdays']; $promoroom->RoomID = $Roomid; $promoroom->CategoryName = $Promoname; $promoroom->PromoRate = $Promorate; $promoroom->Discount = $Discount; $promoroom->Descript = $Descript; $promoroom->Status = $Status; $promoroom->DateStart = $Start; $promoroom->DateEnd = $End; if ($promoroom->AddPromo()) { //Room::UpdateStatus($Roomid); echo "success"; //$_SESSION["numberofdays"] = array("numberofdays" => $Numberofdays } }