function do_save_new_schedules($f3, $args) { $allData = json_decode(f3()->get('SESSION.uploadPrograms'), true); db()->begin(); foreach ($allData['schedules'] as $prog) { $program = Program::get_program_by_codename($prog['c']); if (empty($program)) { $program['title'] = $prog['c']; $program['uri'] = ''; $program['id'] = 0; } db()->exec("INSERT INTO `" . tpf() . "schedules`(`title`, `uri`, `program_id`, `start_date`, `end_date`, `status`, `last_ts`, " . "`last_user`, `insert_user`, `insert_ts`) VALUES ('" . $program['title'] . "', '" . $program['uri'] . "', '" . $program['id'] . "', '" . $prog['d'] . " " . $prog['s'] . ":00', '" . $prog['d'] . " " . $prog['e'] . ":00', 'Yes', '" . date('Y-m-d H:i:s') . "', '" . rStaff::_CStaff('id') . "', '" . rStaff::_CStaff('id') . "', '" . date('Y-m-d H:i:s') . "')"); } db()->commit(); return parent::_return(1, $allData['schedules']); }
public function actionAdmin() { $model = new Program('search'); $model->unsetAttributes(); if (isset($_GET['Program'])) { $model->setAttributes($_GET['Program']); } $this->render('admin', array('model' => $model)); }
public static function getAllProgramsFromDatabase($dbConn) { $programIds = readFromDatabase::readEntireColumnFromTable($dbConn, array(self::ID_COLUMN_NAME), self::TABLE_NAME); $programs = array(); foreach ($programIds as $programId) { $program = new Program($dbConn, $programId[self::ID_COLUMN_NAME]); $programs[$program->getId()] = $program->getName(); } return $programs; }
public static function Main() { echo "HELLO\n"; $app = new Program(array(new Item(array('name' => "+5 Dexterity Vest", 'sellIn' => 10, 'quality' => 20)), new Item(array('name' => "Aged Brie", 'sellIn' => 2, 'quality' => 0)), new Item(array('name' => "Elixir of the Mongoose", 'sellIn' => 5, 'quality' => 7)), new Item(array('name' => "Sulfuras, Hand of Ragnaros", 'sellIn' => 0, 'quality' => 80)), new Item(array('name' => "Backstage passes to a TAFKAL80ETC concert", 'sellIn' => 15, 'quality' => 20)), new Item(array('name' => "Conjured Mana Cake", 'sellIn' => 3, 'quality' => 6)))); $app->UpdateQuality(); echo sprintf("%50s - %7s - %7s\n", "Name", "SellIn", "Quality"); foreach ($app->items as $item) { echo sprintf("%50s - %7d - %7d\n", $item->name, $item->sellIn, $item->quality); } }
/** @test */ public function evaluateShouldTokenizeAndParseCode() { $lexer = $this->getMock('Igorw\\Ilias\\Lexer'); $lexer->expects($this->once())->method('tokenize')->with('2')->will($this->returnValue(['2'])); $reader = $this->getMock('Igorw\\Ilias\\Reader'); $reader->expects($this->once())->method('parse')->with(['2'])->will($this->returnValue([2])); $builder = $this->getMock('Igorw\\Ilias\\FormTreeBuilder'); $builder->expects($this->once())->method('parseAst')->with([2])->will($this->returnValue([new Form\LiteralForm(2)])); $walker = $this->getMock('Igorw\\Ilias\\Walker'); $walker->expects($this->once())->method('expand')->with($this->isInstanceOf('Igorw\\Ilias\\Environment'), $this->isInstanceOf('Igorw\\Ilias\\Form\\Form'))->will($this->returnArgument(1)); $env = $this->getMock('Igorw\\Ilias\\Environment'); $program = new Program($lexer, $reader, $builder, $walker); $this->assertSame(2, $program->evaluate($env, '2')); }
public function index() { $hours = Hour::all(); $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $menu = 'data'; return View::make('hours.index', compact('hours', 'programs', 'menu')); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('studentdelayed', function (Blueprint $table) { $table->increments('id'); $table->integer('studentid'); $table->integer('programid'); $table->integer('collegeid'); $table->integer('semesters'); $table->timestamps(); }); $students = Studentdropout::select('studentid', 'programid', 'collegeid', 'semesters')->where('semesters', '>', 8)->get(); foreach ($students as $student) { $programid = $student->programid; $semesters = $student->semesters; $programYears = Program::select('numyears')->where('programid', $programid)->first()->numyears; if ($semesters > $programYears * 2) { $newEntry = new Studentdelayed(); $newEntry->studentid = $student->studentid; $newEntry->programid = $programid; $newEntry->collegeid = $student->collegeid; $newEntry->semesters = $semesters; $newEntry->save(); } } }
public function postDelete() { $id = Input::get('id'); $delpro = Program::find($id); $delpro->delete(); return 1; }
/** * simpleReserve * * @TODO 同時間帯に別のチャンネルを予約している場合に警告 * 同一番組をすでに予約している場合は上書きする */ public static function simpleReserve($program_disc) { $db = DB::conn(); $program = Program::get($program_disc); $row = array('program_disc' => $program->program_disc, 'autorec' => 0, 'mode' => 0, 'job' => 0); return $db->replace(self::TABLE, $row); }
public function showSpecificProgram() { $programIDInput = Input::get('program-dropdown'); $program = Program::find($programIDInput); //ave students per year and ave difference $yearsArray = Studentterm::where('programid', $program->programid)->where('year', '>', 1999)->where('year', '<', 2014)->groupBy('year')->orderBy('year', 'asc')->lists('year'); $yearlyStudentAverage = []; $yearlySemDifference = []; foreach ($yearsArray as $yearData) { $aveStudents = $program->getYearlyAveStudents($yearData); if ($aveStudents > 1) { $yearlyStudentAverage[$yearData] = $aveStudents; } } $aveYearsOfStay = $program->getAveYearsOfStay(); $aveYearsBeforeDropout = $program->getAveYearsBeforeDropout(); $aveYearsBeforeShifting = $program->getAveYearsBeforeShifting(); $aveAttrition = $program->getAveAttrition(); $aveShiftRate = $program->getAveShiftRate(); $batchAttrition = $program->getBatchAttrition(); $batchShiftRate = $program->getBatchShiftRate(); $division = $program->getDivision(); $numYears = $program->getNumYears(); $gradeCount = $program->getGradeCount(); $shiftGradeCount = $program->getShiftGradeCount(); $stbracketCount = $program->getSTBracketCount(); $shiftBracketCount = $program->getShiftSTBracketCount(); return View::make('program.program-specific', ['program' => $program, 'aveYearsOfStay' => $aveYearsOfStay, 'yearlyStudentAverage' => $yearlyStudentAverage, 'aveYearsBeforeShifting' => $aveYearsBeforeShifting, 'aveYearsBeforeDropout' => $aveYearsBeforeDropout, 'aveAttrition' => $aveAttrition, 'batchAttrition' => $batchAttrition, 'aveShiftRate' => $aveShiftRate, 'batchShiftRate' => $batchShiftRate, 'division' => $division, 'numYears' => $numYears, 'gradeCount' => $gradeCount, 'shiftGradeCount' => $shiftGradeCount, 'stbracketCount' => $stbracketCount, 'shiftBracketCount' => $shiftBracketCount]); }
public function testGetId() { $rows = Program::search('', array()); $row = current($rows); $this->assertEquals('program', strtolower(get_class(Program::get($row['program_disc'])))); $this->assertFalse(Program::get('dummy')); }
public function listofmodule($request, $response) {/*{{{*/ $response->programList = DAL::get()->find_all('Program'); $moduleId = $request->moduleid; $programId = $request->programid; $response->moduleId = $moduleId; $response->moduleid_seleted = $request->moduleid; $response->programid_seleted = $request->programid; $response->module = Module::getById($moduleId); $response->funpoints = array(); if($response->module instanceof Module) { $response->funpoints = $response->module->getFunpoints(); //fix programid_seleted $response->programid_seleted = $response->module->program->id; $response->program = $response->module->program; }elseif($request->programid > 0){ $response->program = Program::getById($request->programid); $response->funpoints = $response->program->getFunpoints(); } }/*}}}*/
public function studentPerprogramFilter($id) { $program_id = $id; $program = Program::with('courses')->find($program_id); $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $menu = 'report'; return View::make('reports.studentperprogram', compact('programs', 'program', 'menu')); }
public static function getCommentProgram($thread_id) { $comment = Comment::model()->findByPk($thread_id); if (isset($comment) && !is_null($comment)) { $prod = Program::model()->findByPk($comment->content_id); return array('id' => $prod->id, 'name' => $prod->name, 'poster' => $prod->poster, 'type' => $prod->pro_type); } return array('id' => '', 'name' => '', 'poster' => '', 'type' => ''); }
public function actionGetProgram() { if (Yii::app()->request->isAjaxRequest) { if ($_POST) { $dataProgram = Program::model()->findAll('tahun_anggaran=:tahun_anggaran AND status = 0', array(':tahun_anggaran' => $_POST['tahun_anggaran'])); $this->renderPartial('_program', array('dataProgram' => $dataProgram)); } } }
/** * Write a program to a file * * @param Program $prog * @param string $filename */ public static function writeProgram(Program $prog, $filename) { if ($handle = fopen($filename, 'w')) { for ($k = 0; $k < $prog->getStatementCount(); $k++) { fprintf($handle, "%s\n", $prog->getStatement($k)->dumpWamCode()); } $handle = fclose($handle); } return $handle; }
public function edit($id) { $course = Course::find($id); $classifications = Classification::all(); $generations = Generation::all(); $programs = Program::all(); $majors = Major::all(); $menu = 'project'; return View::make('courses.edit', compact('course', 'classifications', 'programs', 'generations', 'majors', 'menu')); }
public function destroy($id) { $program = Program::with('courses')->find($id); if ($program->courses->count() > 0) { Session::flash('message', 'Tidak dapat menutup program! Program ini pernah berjalan'); } else { Program::destroy($id); Session::flash('message', 'Sukses menutup program!'); return Redirect::route('programs.index'); } }
/** * Search for all the Applications belonging to a program * @param Program $program * @param boolean $onlyPublished only find publisehd applications * @param boolean $onlyVisible only find visible applications * @param array $excludedIds any application ids to exclude * @return Doctrine\Common\Collections\Collection $applications */ public function findByProgram(Program $program, $onlyPublished = false, $onlyVisible = false, array $excludedIds = array()) { $queryBuilder = $this->_em->createQueryBuilder(); $queryBuilder->add('select', 'a')->from('Jazzee\\Entity\\Application', 'a'); $queryBuilder->where('a.program = :programId'); $queryBuilder->setParameter('programId', $program->getId()); if ($onlyPublished) { $queryBuilder->andWhere('a.published = true'); } if ($onlyVisible) { $queryBuilder->andWhere('a.visible = true'); } if (!empty($excludedIds)) { //force integers from the values $safeids = array_map('intval', $excludedIds); $ids = implode(',', $safeids); $queryBuilder->andWhere("a.id NOT IN ({$ids})"); } return $queryBuilder->getQuery()->getResult(); }
public function suggestIssue($course_id) { $course = Course::find($course_id); $program = Program::find($course->program->id); $year = date('y'); $month = date('m'); $counter = Issue::where('project_id', '=', Auth::user()->curr_project_id)->count(); $counter += 1; $issue = substr($program->name, 0, 1) . $year . $month . str_pad($counter, 5, "0", STR_PAD_LEFT); return Response::json(array('issue' => $issue)); }
public function __construct($xml){ if(useUTC()) $this->StartTime=gmdate('Y-m-d H:i:s'); else $this->StartTime=date('Y-m-d H:i:s'); $this->EndTime=$this->StartTime; $this->SubTitle='Information'; $this->ProgramId=$this->SubTitle; $this->Category=$this->SubTitle; parent::__construct($xml); }
public function editReservation() { if (!isset($_POST['reserve_id'])) { exit('Error: 予約idが指定されていません'); } $reserve_id = $_POST['reserve_id']; $program = Program::get($reserve_id); if ($program === false) { exit('Error: 指定された番組idは存在しません'); } $program->update(array('title' => $_POST['title'], 'description' => $_POST['description'])); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('studentdropouts', function (Blueprint $table) { // }); $students = Studentdropout::select('id', 'programid', 'semesters')->where('semesters', '>', 8)->get(); foreach ($students as $student) { $programYears = Program::select('numyears')->where('programid', $student->programid)->first()->numyears; if ($student->semesters > $programYears * 2) { Studentdropout::find($student->id)->delete(); } } }
public static function getCollPrograms($collegeid) { $departments = Department::select('unitid')->where('parentunitid', $collegeid)->groupBy('unitid')->get(); $departmentids = []; foreach ($departments as $department) { array_push($departmentids, $department->unitid); } $programs = Program::select('programid')->whereIn('unitid', $departmentids)->where('degreelevel', 'U')->groupBy('programid')->get(); $programids = []; foreach ($programs as $program) { array_push($programids, $program->programid); } return $programids; }
function page_head($title) { ini_set('session.save_path', realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../session')); session_start(); ?> <!DOCTYPE html> <html lang="sk-SK"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="fll, lego, letna liga"> <meta name="author" content="Chaos"> <meta data-trans-title="<?php echo $title; ?> "> <title><?php echo $title; ?> </title> <link rel="icon" href="favicon.ico" type="image/x-icon"> <link type="text/css" href="css/styles.css" rel="stylesheet"> <link type="text/css" href="css/dropdownmenu.css" rel="stylesheet"> <link type="text/css" href="css/stylesMin.css" rel="stylesheet" media="(max-width:530px)"> <script type="text/javascript" src="js/iframeresize.js" ></script> <script type="text/javascript" src="js/dropdownmenu.js" ></script> <script type="text/javascript" src="js/translator.js" ></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <script> $(document).ready(function(){ dict.translateElement(); }); window.onload = function() { sendResizeRequest(); }; </script> <body> <div id="wrapper"> <a href="."><h1 data-trans-key="main-header"></h1></a> <?php Image::setIcon("images/image.png"); Video::setIcon("images/video.png"); Program::setIcon("images/file.png"); }
public function getYearlySemDifference($year) { $studentsSem1 = $this->studentterms()->where('aysem', strval($year) . '1')->count(); $studentsSem2 = $this->studentterms()->where('aysem', strval($year) . '2')->count(); if ($this->programid == 28) { $domProgram = Program::where('programid', 38)->first(); $domSem1 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '1')->count(); $domSem2 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '2')->count(); $studentsSem1 = $studentsSem1 + $domSem1; $studentsSem2 = $studentsSem2 + $domSem2; } $semDifference = $studentsSem2 - $studentsSem1; return $semDifference; }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('units', function (Blueprint $table) { $table->decimal('years_before_drop')->nullable(); }); //campus $campus = Campus::where('unitid', 2)->first(); $campus->years_before_drop = $campus->getAveYearsBeforeDropout(); $campus->ave_batch_attrition = $campus->getAveAttrition(); $campus->save(['timestamps' => false]); //program $programlist = Program::where('programs.degreelevel', 'U')->whereNotIn('programs.programid', array(62, 66, 38, 22))->get(); foreach ($programlist as $program) { $program->years_stay = $program->getAveYearsOfStay(); $program->years_before_shift = $program->getAveYearsBeforeShifting(); $program->years_before_drop = $program->getAveYearsBeforeDropout(); $program->ave_batch_attrition = $program->getAveAttrition(); $program->ave_batch_shift = $program->getAveShiftRate(); $program->ave_students = $program->getAveStudents(); $program->save(['timestamps' => false]); } //department $departmentlist = Department::whereHas('programs', function ($q) { $q->whereNotIn('programid', array(62, 66, 38, 22)); $q->where('degreelevel', 'U'); })->get(); foreach ($departmentlist as $department) { $department->ave_batch_attrition = $department->getAveAttrition(); $department->ave_batch_shift = $department->getAveShiftRate(); $department->ave_students = $department->getAveStudents(); $department->save(['timestamps' => false]); } //college $departmentlist = Department::whereHas('programs', function ($q) { $q->whereNotIn('programid', array(62, 66, 38, 22)); $q->where('degreelevel', 'U'); })->get(); $collegelist = []; foreach ($departmentlist as $department) { array_push($collegelist, $department->college); } $collegelist = array_unique($collegelist); foreach ($collegelist as $college) { $college->ave_batch_attrition = $college->getAveAttrition(); $college->ave_batch_shift = $college->getAveShiftRate(); $college->ave_students = $college->getAveStudents(); $college->save(['timestamps' => false]); } }
public function getYearlySemDifference($year) { $programs = $this->programs()->whereNotIn('programid', array(62, 66, 38, 117))->where('degreelevel', 'U')->lists('programid'); $studentsSem1 = Studentterm::where('aysem', strval($year) . '1')->whereIn('programid', $programs)->count(); $studentsSem2 = Studentterm::where('aysem', strval($year) . '2')->whereIn('programid', $programs)->count(); //if College of Medicine if ($this->unitid === 7) { $domProgram = Program::where('programid', 38)->first(); $domSem1 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '1')->count(); $domSem2 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '2')->count(); $studentsSem1 = $studentsSem1 + $domSem1; $studentsSem2 = $studentsSem2 + $domSem2; } $semDifference = $studentsSem2 - $studentsSem1; return $semDifference; }
/** * Get the navigation * @return Navigation */ public function getNavigation() { if (empty($this->program) and empty($this->application)) { return null; } $navigation = new \Foundation\Navigation\Container(); $menu = new \Foundation\Navigation\Menu(); $menu->setTitle('Navigation'); if (empty($this->application)) { $link = new \Foundation\Navigation\Link('Welcome'); $link->setHref($this->path('apply')); $menu->addLink($link); } else { $path = 'apply/' . $this->program->getShortName() . '/' . $this->cycle->getName(); $link = new \Foundation\Navigation\Link('Welcome'); $link->setHref($this->path($path)); $link->setCurrent(true); $menu->addLink($link); //Only show the other cycles link if there are other published visible cycles $applications = $this->_em->getRepository('Jazzee\\Entity\\Application')->findByProgram($this->program, false, true, array($this->application->getId())); if (count($applications) > 0) { $link = new \Foundation\Navigation\Link('Other Cycles'); $link->setHref($this->path('apply/' . $this->program->getShortName())); $menu->addLink($link); } $link = new \Foundation\Navigation\Link('Returning Applicants'); $link->setHref($this->path($path . '/applicant/login')); $menu->addLink($link); if (!$this->application->isByInvitationOnly()) { $link = new \Foundation\Navigation\Link('Start a New Application'); $link->addClass('highlight'); $link->setHref($this->path($path . '/applicant/new')); $menu->addLink($link); } } $navigation->addMenu($menu); if ($this->isPreviewMode()) { $menu = new \Foundation\Navigation\Menu(); $navigation->addMenu($menu); $menu->setTitle('Preview Functions'); $link = new \Foundation\Navigation\Link('Become Administrator'); $link->setHref($this->path('admin/login')); $menu->addLink($link); } return $navigation; }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('correlations', function (Blueprint $table) { // }); $batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]; $allStudents = []; $programs = Program::select('programid')->get(); foreach ($programs as $program) { $programid = $program->programid; foreach ($batches as $batch) { $allStudents[$batch] = Studentterm::getBatchStudentsProgram($batch * 100000, $programid); } $this->alterOverload($batches, $allStudents, $programid); $this->alterUnits($batches, $allStudents, $programid); } }