public function getDate(Year $year) { /** * We do not rely on the easter_date function in order to always * calculate te Polish easter date (not depending on the timezone) */ $a = $year->getYear() % 19; $b = floor($year->getYear() / 100); $c = $year->getYear() % 100; $d = floor($b / 4); $e = $b % 4; $f = floor(($b + 8) / 25); $g = floor(($b - $f + 1) / 3); $h = (19 * $a + $b - $d - $g + 15) % 30; $i = floor($c / 4); $k = $c % 4; $l = (32 + 2 * $e + 2 * $i - $h - $k) % 7; $m = floor(($a + 11 * $h + 22 * $l) / 451); $p = $h + $l - 7 * $m + 114; $day = $p % 31 + 1; $month = floor($p / 31); $date = new \DateTime($year->getYear() . '-' . $month . '-' . $day); $date->add(new \DateInterval('P' . $this->easterDayOffset . 'D')); return $date; }
public function testScaffoldFormFieldLast() { $year = new Year(); $field = $year->scaffoldFormField("YearTest"); $source = $field->getSource(); //The first one should be the current year $currentYear = (int) date('Y'); $firstValue = reset($source); $firstKey = key($source); $this->assertEquals($currentYear, $firstValue); $this->assertEquals($currentYear, $firstKey); }
public function run() { Eloquent::unguard(); DB::table('years')->delete(); Year::create(['id' => 1, 'year' => 2015, 'nombre_colegio' => 'LICEO ADVENTISTA LIBERTAD', 'abrev_colegio' => 'LAL', 'nota_minima_aceptada' => 70, 'resolucion' => 'RESOLUCIÓN 2563 DE 2014', 'actual' => true, 'alumnos_can_see_notas' => true]); $this->command->info("Año 2014 y 2015 agregados."); /* OTRA FORMA ******************************************************************** // Abrimos el archivo donde tengo los municipios restantes de Colombia // recorremos los registros y los ingresamos a la base de datos $this->command->info("Leemos los csv para las cuidades colombianas faltantes..."); $csv = dirname(__FILE__) .'/SqlTables/CuidadesDeColombia.csv'; $file_handle = fopen($csv, "r"); while (!feof($file_handle)) { $line = fgetcsv($file_handle); if (empty($line)) { continue; // skip blank lines } $c = array(); $c['nombre'] = $line[0]; $c['pais_codigo'] = $line[1]; $c['distrito'] = $line[2]; $c['poblacion'] = $line[3]; //$this->command->info( implode(",", $c)); DB::table('ciudads')->insert($c); } fclose($file_handle); */ }
public function mailing_list($year = "_") { if ($year == "_" || $year == Year::current_year()->year) { $year_alias = ""; } else { $year_alias = '.' . Year::where('year', '=', $year)->select('alias')->first()->alias; } return $this->alias . $year_alias . '@cserevue.org.au'; }
public function get_user_status($user_id) { $user = DB::table('team_user')->where('team_id', '=', $this->id)->where('user_id', '=', $user_id)->where('year_id', '=', Year::current_year()->id)->first(); $status = ''; if ($user != NULL) { $status .= $user->status; } return $status; }
public function get_manage($id) { $executive = Executive::find($id); $year = Year::current_year(); $users = array(); foreach ($year->users as $a) { $users[] = $a->profile->full_name; } return View::make('executives.manage')->with('executive', $executive)->with('users', $users)->with('year', $year); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('years', function (Blueprint $table) { $table->increments('id'); $table->integer('year'); $table->timestamps(); }); $aysemRaw = DB::table('studentterms')->select('aysem', DB::raw('COUNT (*) as studentcount'))->whereRaw('char_length(aysem::varchar(255)) = 5 and aysem::varchar(255) NOT LIKE \'%3\'')->groupBy('aysem')->havingRaw('count(*) > 1')->orderBy('aysem', 'asc')->get(); $prevYear = 0; foreach ($aysemRaw as $yearData) { $currentYear = substr($yearData->aysem, 0, 4); if ($prevYear === 0) { $prevYear = $currentYear; } elseif ($prevYear === $currentYear) { $yearObj = new Year(); $yearObj->year = $currentYear; $yearObj->save(); $prevYear = 0; } } }
public static function getAllChallenges() { if (!self::$allFetched) { $items = query(__CLASS__)->where(array('year' => Year::current()))->sort('name')->selectMultiple(); self::$cache = array(); foreach ($items as $item) { self::$cache[$item->id] = $item; } self::$allFetched = true; } return self::$cache; }
public static function getAll() { $items = query(__CLASS__)->selectMultiple(); self::$cache = array(); foreach ($items as $item) { self::$cache[$item->id] = $item; if ($item->current) { self::$currentYearID = $item->id; } } return $items; }
public function post_edit() { $input = Input::get(); $camp = CampSetting::where('year_id', '=', Year::current_year()->id); $camp_reg = DB::table('camp_registrations')->where('camp_setting_id', '=', $camp->first()->id)->where('user_id', '=', Auth::user()->id); $rules = array('id' => 'required', 'car_places' => 'integer'); $validation = Validator::make($input, $rules); if ($validation->passes()) { $camp_reg->update(Input::except('_token')); return Redirect::to('rms/camp/registrations/edit')->with('success', 'Successfully Edited registration for Camp'); } else { return Redirect::to('rms/camp/registrations/edit')->withErrors($validation)->withInput(); } }
public function get_admin($current = 'current') { if ($current == 'current') { $year = Year::current_year(); } else { $year = Year::find($current); } if ($year) { $orders = MerchOrder::where('year_id', '=', $year->id)->get(); $items = MerchItem::current_merch(); $sizes = array('8' => '8', '10' => '10', '12' => '12', '14' => '14', 'XS' => 'XS', 'S' => 'S', 'M' => 'M', 'L' => 'L', 'XL' => 'XL', 'XXL' => 'XXL'); return View::make('merch.orders.admin')->with('orders', $orders)->with('items', $items)->with('sizes', $sizes)->with('year', $year); } else { return "Invalid ID"; } }
public function get_search($format = '.html') { $input = Input::get(); $years = Year::lists('year', 'id'); if (array_key_exists('q', $input) && $input['q'] != '') { $q = $input['q']; $year_id = $input['y']; $year = Year::find($year_id)->year; if (strlen($q) > 8) { $phone_query = $q; } else { $phone_query = 'NOTAPHONENUMBER'; } if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,})\$/i", $q)) { $email_query = $q; } else { $email_query = 'NOTANEMAILADDRESS'; } $results = User::join('profiles', 'users.id', '=', 'profiles.user_id')->join('user_year', 'users.id', '=', 'user_year.user_id')->where('year_id', '=', $year_id)->where(function ($query) use($q, $email_query, $phone_query) { $query->orWhere('full_name', 'LIKE', '%' . $q . '%'); $query->orWhere('display_name', 'LIKE', '%' . $q . '%'); $query->orWhere('email', 'LIKE', '%' . $email_query . '%'); $query->orWhere('phone', 'LIKE', '%' . $phone_query . '%'); })->get(); } else { $q = ''; $year = Year::current_year()->year; $results = array(); } switch ($format) { case '.csv': return View::make('users.search_csv')->with('results', $results); default: return View::make('users.search')->with('query', $q)->with('year', $year)->with('years', $years)->with('results', $results); } }
public static function current_bundles() { return WellbeingBundle::where('year_id', '=', Year::current_year()->id); }
{ ?> <div class="portlet box yellow" style="width:100%;margin-top:20px;"> <i class="icon-reorder"></i> <div class="portlet-title"><span class="box-title">Batchwise Student History Report</span> <div class="operation"> <?php echo CHtml::link('Excel', array('BranchwiseAllStudentsFeesDetailInfoReport','excel'=>'excel','Year[year]'=>$year, 'FeesPaymentTransaction[fees_student_branch_id]'=>$branch), array('class'=>'btnblue'));?> </div> </div> <div class="portlet-body" > <?php $org = Organization::model()->findAll(); $org_data=$org[0]; $branch_model=Branch::model()->findByPk($branch); $yr=Year::model()->findByPk($year); ?> <?php echo '<table class="report-table" border=2 > '; echo "<tr align=center> <th colspan = 60 style=text-align:left;> ".CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id'=>$org_data->organization_id)),'No Image',array('width'=>80,'height'=>55,'style'=>'float:left;margin-left:200px;')) ." <big> <b>".$org_data->organization_name ."</big><br>". $org_data->address_line1." ".$org_data->address_line2."</br>" . City::model()->findBypk($org_data->city)->city_name.", ".State::model()->findBypk($org_data->state)->state_name.", ".Country::model()->findBypk($org_data->country)->name."." ." </th> <br> </tr>"; echo "<tr><th colspan=60><h3> Batch-".$yr->year." Branch of ".$branch_model->branch_name." All Students Fees Collection Report</h3></th> </tr>"; echo "<tr class='table_header'>"; echo "<th > SI<br> No.</th>"; echo "<th> Enrollement<br> No. </th>"; echo "<th colspan=2 > Student Full Name</th>"; foreach($startYear as $y) {
echo $form->labelEx($model, 'company_name'); ?> </td> <td width="60%"> <?php echo $form->dropDownList($model, 'company_name', CHtml::listData(Registration::model()->findAll('1 ORDER BY company_name'), 'company_id', 'company_name'), array('prompt' => 'Please Choose', 'name' => 'General_company_name', 'id' => 'General_company_name')); ?> </td></tr> <tr><td> <?php echo $form->labelEx($model, 'year'); ?> </td> <td> <?php echo $form->dropDownList($model, 'year', CHtml::listData(Year::model()->findAll(), 'year', 'year'), array('name' => 'year', 'prompt' => 'Please Choose')); ?> <?php echo $form->error($model, 'year'); ?> </td> </tr> </table> <table border="0" width="980" id="CreateGeneralLedgerTable"> </table> <input type="submit" id="GenerateGeneralLedger" name="GenerateGeneralLedger" class="btn btn-warning" value="Generate" /> <?php $this->endWidget();
</table> </form> <div id="loading" class="alert alert-info" role="alert" style="display: none"> </div> <?php } else { if ($do == 'add') { extract($_POST); Year::create($year, $era); if ($era == 1) { $dis = $year . ' UFY'; } else { $dis = $year . ' IRY'; } Event::addEvent('Year ' . $dis . ' has been added.', $_SESSION['user'], 1); } } } else { if ($action == 'current') { $year = new Year($_GET['id']); $year->makeCurrent(); Event::addEvent('Year ' . $year->getFullYear() . ' is now the current year.', $_SESSION['user'], 2); ?> <script> load('irclockup', 'none', 'none'); </script> <?php } } }
public function get_edit($id) { $years = Year::lists('year', 'id'); $camp = CampSetting::find($id); return View::make('camp.settings.edit')->with('camp', $camp)->with('years', $years); }
$team_id = Request::segment(4); $team = Team::find($team_id); if (!Auth::User()->admin && !Auth::User()->is_currently_part_of_exec() && $team->privacy == 1 && !Auth::User()->is_part_of_team(Year::current_year()->id, $team_id)) { return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin'); } }); Route::filter('manage_team', function () { $team_id = Request::segment(4); if (!Auth::User()->can_manage_team($team_id)) { return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin'); } }); Route::filter('signed_up_for_camp', function () { if (Auth::user()->has_signed_up_for_camp()) { return Redirect::to('rms/camp/registrations/edit'); } }); Route::filter('orgs', function () { $on_orgs = false; $teams = DB::table('teams')->where('privacy', '=', '0')->lists('id'); foreach ($teams as $team) { $count = DB::table('team_user')->where('team_id', '=', $team)->where('year_id', '=', Year::current_year()->id)->where('status', '=', 'head')->where('user_id', '=', Auth::User()->id)->get(); if (count($count) != 0) { $on_orgs = true; break; } } if (!Auth::User()->admin && !Auth::User()->is_currently_part_of_exec() && !$on_orgs) { return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin'); } });
/** * Test Converting Methods * */ function test_converting() { // Converting $timespan = Year::startingDuration(DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 5, 4, 15, 25, 10, Duration::withHours(-4)), Duration::withDays(10)); // asDate() $temp = $timespan->asDate(); $this->assertTrue($temp->isEqualTo(Date::withYearMonthDay(2005, 5, 4))); // asDateAndTime() $temp = $timespan->asDateAndTime(); $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 00, 00, 00))); // asDuration() $temp = $timespan->asDuration(); $this->assertTrue($temp->isEqualTo(Duration::withDays(365))); // asMonth() $temp = $timespan->asMonth(); $this->assertTrue($temp->isEqualTo(Month::withMonthYear(5, 2005))); // asTime() $temp = $timespan->asTime(); $dateAndTime = DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0); $this->assertTrue($temp->isEqualTo($dateAndTime->asTime())); // asTimeStamp() $temp = $timespan->asTimeStamp(); $this->assertTrue($temp->isEqualTo(TimeStamp::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0))); // asWeek() $temp = $timespan->asWeek(); $this->assertTrue($temp->isEqualTo(Week::starting(Date::withYearMonthDay(2005, 5, 1)))); // asYear() $temp = $timespan->asYear(); $this->assertTrue($temp->isEqualTo(Year::starting(Date::withYearMonthDay(2005, 5, 4)))); // to() $temp = $timespan->to(Date::withYearMonthDay(2005, 10, 1)); $comparison = Timespan::startingEnding(DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0), Date::withYearMonthDay(2005, 10, 1)); $this->assertTrue($temp->isEqualTo($comparison)); }
/** * Return the number of days in a year. * * @param integer $anInteger * @return integer * @access public * @since 10/15/08 * @static */ public static function getDaysInYear($anInteger) { if (is_null($anInteger)) { throw new InvalidArgumentException("Cannot execute daysInYear for NULL."); } if (Year::isYearLeapYear($anInteger)) { return 365 + 1; } else { return 365; } }
public function getSemDifference() { $yearsArray = Year::where('year', '>', 1998)->get(); $yearlySemDifference = []; foreach ($yearsArray as $yearData) { $yearlySemDifference[$yearData->year] = $yearData->getSemDifference(); } return $yearlySemDifference; }
/** * Answer the days in this month on a given year. * * @param string $indexOrNameString * @param ingteger $yearInteger * @return integer * @access public * @since 5/5/05 * @static */ static function daysInMonthForYear($indexOrNameString, $yearInteger) { if (is_numeric($indexOrNameString)) { $index = $indexOrNameString; } else { $index = Month::indexOfMonth($indexOrNameString); } if ($index < 1 | $index > 12) { $errorString = $index . " is not a valid month index."; if (function_exists('throwError')) { throwError(new Error($errorString)); } else { die($errorString); } } $monthDays = ChronologyConstants::DaysInMonth(); $days = $monthDays[$index]; if ($index == 2 && Year::isYearLeapYear($yearInteger)) { return $days + 1; } else { return $days; } }
<?php require_once "conf/top.php"; require_once "models/class.Promo.php"; require_once "models/class.Year.php"; $promo = new Promo(); $user = new User(); $annee = new Year(); $promo_list = $promo::getAll(); $user_list = $user::getAll(); $annee_list = $annee->Annee(); echo $twig->render("promo_list.html.twig", array("promo" => $promo_list, "annee" => $annee_list, "users" => $user_list));
<?php require_once "conf/top.php"; //$user = new User($_SESSION['user_session']); include_once 'models/class.User.php'; include_once 'models/class.Year.php'; include_once 'models/class.Doc.php'; include_once 'models/class.Cours.php'; $year = new Year(); $doc = new Doc($_REQUEST['did']); $cours = new Cours($_REQUEST['cid']); if (!empty($_REQUEST['pid'])) { $envoi = new Mail(); $email = $year->returnMaill($_REQUEST['pid']); $email[0]['promo_mail'] . "<br />"; $cours = $cours->getLibelle(); $doc = $doc->_toString(); $subject = "LinCS2i - Nouveau cours - " . $cours . " - " . $doc . ""; $message = "Bonjour, Le fichier " . $doc . " de " . $cours . " est désormais disponible"; $envoi->sendmail($email[0]['promo_mail'], $subject, $message); $session->redirect('mes_cours.php'); }
private static function loadItems() { self::$_items = array(); $models = self::model()->findAll(); foreach ($models as $model) { self::$_items[$model->year_id] = $model->year; } }
$message = '資料寫入錯誤'; } Classes::syncTeacher(); return Redirect::to('/class_year/view_year/' . $yearId)->with('message', $message); } }); // 執行刪除班級 Route::get('/delete_classes/{classesId}/{yearId}', function ($classesId, $yearId) { $classes = Classes::find($classesId); $message = '刪除《' . $classes->classes_name . '》完成'; $classes->delete(); return Redirect::to('/class_year/view_year/' . $yearId)->with('message', $message); }); // 執行刪除年級 Route::get('/delete_year/{yearId}', function ($yearId) { $year = Year::find($yearId); $message = '刪除《' . $year->year_name . '》完成'; $year->delete(); return Redirect::to('/class_year')->with('message', $message); }); }); /** * 課程管理 */ Route::group(array('prefix' => 'course', 'before' => 'auth'), function () { // 顯示課程名稱 Route::get('/', function () { $courseList = Course::orderBy('course_name')->get(); return View::make('course')->with(array('courseList' => $courseList)); }); // 執行新增課程
foreach ($prefixes as $prefix) { $formDistance = $prefix . 'Distance'; $formDirection = $prefix . 'Direction'; $formCity = $prefix . 'City'; $isNull = $formData[$formDistance] == null || $formData[$formDirection] == null || $formData[$formCity] == null; if ($isNull) { $formData[$formDistance] = null; $formData[$formDirection] = null; $formData[$formCity] = null; } } return $formData; } switch ($action) { case 'new': $clue = new Clue(array('year' => Year::current(), 'name' => $clue_name, 'time' => $clue_time)); $clue->doAdd('Created clue successfully.'); break; case 'edit': $clue = Clue::getClue($clue_id); $form_data = setNullIfEmpty($_POST); $form_data = coagulateTimes($form_data, array('', 'start', 'hint', 'answer')); $form_data = coagulateLocs($form_data, array('start', 'hint', 'answer')); $clue->makeChanges($form_data); $clue->doUpdate('Edited clue successfully.'); break; case 'delete': $clue = Clue::getClue($clue_id); foreach ($clue->getClueStates() as $clueState) { $clueState->doRemove(); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Year::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
if (key_exists('remove', $_POST) && $position >= POSITION_ADMIN) { $winner_id = $_POST['winner_id']; $action = 'remove'; } else { if (key_exists('claim', $_POST)) { $code = $_POST['code']; $action = 'claim'; } } } } } // ACTION switch ($action) { case 'new': $challenge = new Challenge(array('year' => Year::current(), 'name' => $challenge_name, 'points' => $challenge_points, 'code' => $challenge_code)); $challenge->doAdd("Created challenge {$challenge_name} successfully."); break; case 'delete': $challenge = Challenge::getChallenge($challenge_id); foreach ($challenge->getWinners() as $winner) { $winner->doRemove(); } $challenge->doRemove("Deleted challenge successfully."); break; case 'add': $winner = new ChallengeWinner(array('team' => $team_id, 'challenge' => $challenge_id)); $winner->doAdd("Added challenge winner successfully."); break; case 'remove': $winner = ChallengeWinner::getChallengeWinner($winner_id);
public static function current_nights() { return WellbeingNight::where('year_id', '=', Year::current_year()->id); }