public function actionSignupsPublic() { $this->redirectHack(); $days = range(2, 6); $c = ClassInfo::findAllWeekdays($days, ClassSession::savedSessionId()); $this->render('signups_public', array('classes' => $c, 'days' => $days)); }
public function actionAutoPopulate() { foreach (ClassInfo::model()->findAllBySQL("select class_info.* from class_info where session_id = :sess", array('sess' => ClassSession::savedSessionId())) as $model) { if ($model->active_mtg_count < 1) { $model->populate_meetings(Yii::app()->params['defaultNumMeetings']); } } //TODO: flash it! $this->redirect($this->redirect(Yii::app()->user->returnUrl)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new DepositDetails(); // set the default session id if it isn't set in the search $model->session_id = ClassSession::savedSessionId(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['DepositDetails'])) { $model->attributes = $_POST['DepositDetails']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } else { // only if this is NOT yet entered $model->deposited_date = date("Y-m-d"); } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new CheckExpense(); // set the default session id if it isn't set in the search $model->session_id = ClassSession::savedSessionId(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CheckExpense'])) { $model->attributes = $_POST['CheckExpense']; if ($model->save()) { $this->redirect(array('index')); } } else { // XXX why do i have to set defaults here, and default in rules doesn't cut it? $model->payer = 'OSS PTO'; } if (isset($_GET['payee_id'])) { $model->payee_id = $_GET['payee_id']; $model->amount = $model->payee->owed; } $this->render('create', array('model' => $model)); }
<?php $es = $form->errorSummary($model); if (isset($es)) { echo '<tr><td colspan="5">' . $es . '</td></tr>'; } ?> <tr> <td> <?php // I cannot use the multiendeddropdown here, because of the odd dropdown if (isset($model->class_id) && !$model->hasErrors()) { echo CHtml::encode($model->class->summary); echo $form->hiddenField($model, "[{$index}]class_id"); } else { echo $form->dropDownList($model, "[{$index}]class_id", array('In Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade >= min_grade_allowed and :grade <= max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary'), 'Outside Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade < min_grade_allowed or :grade > max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary')), array('class' => 'chzn-select', 'empty' => "Choose a class")); } echo $form->error($model, "[{$index}]class_id"); echo '<div id="Signup_' . $index . '_additional_info" >'; ?> </td> <td> <?php echo $form->textField($model, "[{$index}]signup_date", array('size' => 20)); echo $form->error($model, "[{$index}]signup_date"); ?> </td>
<?php require_once "includesmain/functions.php"; require_once "includesmain/database.php"; require_once "includesmain/class.php"; require_once "includesmain/class_session.php"; $activesession = ClassSession::getactivesession(); include 'includes/pagestructure.php'; include 'includes/smartbanner.php'; include 'includes/smartnav.php'; head('Welcome to Urban Illustration'); topbar(); ?> <div id="content"> <div id="maincontent"> <div class="textcontentalone"> <h1>Welcome to the <?php echo $activesession->name; ?> </h1> <h2>Available Classes</h2> <table id="tbschedualdisplay"> <tr class="tabletitle"><td class="classdate">Class Dates</td><td class="avaspots">Available Spots</td><td class="joincls">Join Class</td><td>Notes</td></tr> <?php Classes::frontdisplayclass($activesession->id); ?> </table> </div>
public function getIncomes() { return Income::model()->findAllBySql('select income.* from income left join class_info on income.class_id = class_info.id where income.student_id = :stid and class_info.session_id = :ssid', array('ssid' => ClassSession::savedSessionId(), 'stid' => $this->id)); }
public function actionChooseSession() { // TODO validate! make sure they can only set to what they're allowed if (isset($_POST['ClassSession'])) { ClassSession::setSessionId($_POST['ClassSession']['id']); if (isset($_GET['returnTo'])) { $this->redirect($_GET['returnTo']); } } $this->render('_session_chooser', array('sessions' => ClassSession::allSessions(Yii::app()->user->name != 'admin'), 'saved' => ClassSession::savedSessionId())); }
public function actionCheckNumAC() { if (isset($_GET['term'])) { $c = CheckIncome::model()->findAllBySQL("select check_income.* from check_income where\n(check_num like :text \nor payer like :text)\nand session_id = :sid\nand cash < 1\nand (deposit_id is null or deposit_id < 1)\nand (delivered is null or delivered < '2000-01-01')\nand (returned is null or returned < '2000-01-01')\norder by abs(check_num)\n", array('text' => '%' . $_GET['term'] . '%', 'sid' => ClassSession::savedSessionId())); echo CJSON::encode(array_map(function ($r) { return array('other' => $r->amount, 'label' => $r->summary, 'value' => $r->id); }, $c)); Yii::app()->end(); } //TODO error out, 404? }
if (isset($_GET['rmvclss'])) { Classes::rmvclasses($_GET['rmvclss']); } $sessionexst = ClassSession::find_by_id($_GET['sid']); if (!$sessionexst) { redirect_to("index.php"); } //Adding a session to the db if (isset($_POST['sid'])) { Classes::addclasstodatabase($_POST['class-date'], $_POST['class-time'], $_POST['spots'], $_POST['sid'], $_POST['note']); } if (isset($_POST['cls_id'])) { Classes::updateclass($_POST['cls_id'], $_POST['class-date'], $_POST['class-time'], $_POST['spots'], $_POST['note']); } //finding the info on the class session $currentclasssession = ClassSession::find_by_id($_GET['sid']); $loggedinuser = User::showmeuser($_SESSION['user_id']); include '../includes/pagestructure.php'; include '../includes/smartbanner.php'; include '../includes/smartnav.php'; adminhead('Welcome to Urban Illustration'); admintopbar(); ?> <div id="content"> <div id="maincontent"> <div class="textcontentalone"><p>Welcome, <?php if (isset($loggedinuser)) { echo $loggedinuser; } ?>
</div> <div class="row"> <?php echo $form->labelEx($model, 'class_id'); ?> <?php // I cannot use the multiendeddropdown here, because of the odd dropdown if (isset($model->class_id) && !$model->hasErrors()) { echo CHtml::encode($model->class->summary); echo $form->hiddenField($model, "class_id"); } else { echo $form->dropDownList($model, 'class_id', array('In Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade >= min_grade_allowed and :grade <= max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary'), 'Outside Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade < min_grade_allowed or :grade > max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary')), array('class' => 'chzn-select', 'empty' => 'Choose One', 'ajax' => array('type' => 'POST', 'dataType' => 'json', 'data' => 'js:{id:$("#Signup_class_id").val()}', 'url' => CController::createUrl('ClassInfo/json'), 'success' => "function(data){\n\$('#Signup_additional_info').text( data['enrolled_count'] + ' signed up (' + data['max_students'] + ' max)');\nif(parseInt(data['enrolled_count']) > parseInt(data['max_students'])){\n \$('#Signup_status').val('Waitlist');\n} else{\n \$('#Signup_status').val('Enrolled');\n}\n;}"))); } ?> <?php echo $form->error($model, 'class_id'); ?> <div id="Signup_additional_info" class="infoMessage" ></div> </div> <div class="row">
<p>Welcome, <?php if (isset($loggedinuser)) { echo $loggedinuser; } ?> <a href="?lgt=1">Log Out</a></p> <h2>Available Sessions</h2> <table id="tbschedualdisplay"> <tr class="tabletitle"><td>Session Name</td><td>Starting Date</td><td>Status</td><td>Update</td><td>Delete</td></tr> <?php ClassSession::displaysessions(); ?> </table> <?php if (isset($_GET['s_upd'])) { $updatesession = ClassSession::find_by_id($_GET['s_upd']); ?> <h2><a>Update Session:</a></h2> <form action="index.php" method="post"> <input type="hidden" value="<?php echo $updatesession->id; ?> " name="s_id" /> Session Name: <input type="text" maxlength="40" name="u_session_name" value="<?php echo $updatesession->name; ?> "/> Starting Date: <input type="text" maxlength="40" name="date" value="<?php echo DateManager::displaydatefromtmstp($updatesession->s_date); ?> "/>
public function getIs_expiring() { // no date or 0 date means doesn't expire if ($this->expired == '' || strtotime($this->expired) < 100) { return false; } return strtotime($this->expired) < strtotime(ClassSession::current()->end_date); }
<?php $this->pageTitle = Yii::app()->name; $this->breadcrumbs = array(); // reset ?> <h1>After-School Enrichment Program – <?php echo CHtml::encode($this->savedSessionSummary()); ?> </h1> <?php // XXX this is stupid, move this to a controller, // deal with the whole persomnalized home page thing better $cs = ClassSession::model()->findByPk(ClassSession::savedSessionId()); $this->renderPartial('/admin/signupsheet', array('classes' => $cs->active_classes));
function getClasses() { return ClassInfo::model()->findAllBySql("select class_info.*\nfrom class_info\nleft join instructor_assignment\n on instructor_assignment.class_id = class_info.id\nleft join instructor\n on instructor_assignment.instructor_id = instructor.id\nwhere instructor.company_id = :id\n and class_info.session_id = :sid\norder by class_info.class_name asc", array('id' => $this->id, 'sid' => ClassSession::savedSessionId())); }
public function actionChooseCopy() { /// this is the DO action if (isset($_POST['ClassInfo'])) { if (ClassInfo::copyClass($_POST['ClassInfo']['id'], ClassSession::savedSessionId())) { $this->redirect(array('index')); } } // TODO: display any errors set from the copyclass function $this->render('choose_copy', array('fromsession' => ClassSession::previousPublic())); }
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl . '/css/printabletable.css', 'print'); $reg_begin_tmp = date("l, F jS \\a\\t g:i a", strtotime(ClassSession::current()->registration_starts)); // XXX MOVE THIS TO DB! $signup_contact_move_to_db = 'Kimberly Repp, via email <a href="mailto:oss.asep@gmail.com">oss.asep@gmail.com</a> or phone 650-575-0616.'; // XXX MOVE THIS TO DB! $revised_date_move_to_db = "9/10/13"; ?> <div class="span-17"> <h1 class="fakespan-17 center">After-School Enrichment Program – <?php echo CHtml::encode($this->savedSessionSummary()); ?> </h1> <h3 class="fakespan-17 center">Classes begin <strong><?php echo date('F jS', strtotime(ClassSession::current()->start_date)); ?> </strong>.<br /> Reservations begin <strong> <?php echo $reg_begin_tmp; ?> </strong>!</h3> <h3>Important Notes about Enrollment Process:</h3> <ul> <li> Many classes fill up quickly! <ul><li> First come, first served: <ul><li>Enrollment is determined by the order in which Patricia, in the front office, receives it. </li></ul></li></ul></li> <li>To confirm enrollment, view enrollment status online at www.ossasep.org. The login is: parent and the password is: <?php
/** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array(array('class_name, session_id, company_id', 'required'), array('min_grade_allowed, max_grade_allowed, day_of_week, min_students, max_students, session_id, company_id', 'numerical', 'integerOnly' => true), array('class_name', 'length', 'max' => 128), array('cost_per_class', 'length', 'max' => 19), array('cost_per_class', 'numerical'), array(' status', 'length', 'max' => 100), array(' min_grade_allowed,max_grade_allowed,min_students,max_students', 'length', 'max' => 3), array('location, note', 'length', 'max' => 256), array('start_time, end_time, note', 'safe'), array('id, class_name, min_grade_allowed, max_grade_allowed, start_time, end_time, cost_per_class, max_students, min_students, day_of_week, location, status, session_id, company_id', 'safe', 'on' => 'search'), array('session_id', 'default', 'value' => ClassSession::savedSessionId(), 'setOnEmpty' => true, 'on' => 'insert')); }
public function savedSessionSummary() { // XXX this is stupid. i don't need this here. /// just replace all calls to this nonsense with the classsession static return ClassSession::current()->summary; }
$this->breadcrumbs = array(); // reset ?> <h1>After-School Enrichment Program – <?php echo CHtml::encode($this->savedSessionSummary()); ?> </h1> <h3>Classes begin <strong><?php echo date('F jS', strtotime(ClassSession::current()->start_date)); ?> </strong>.</h3> <!-- TODO: make the reservation begin date dynamically generated --> <h3>Reservations begin <strong> <?php echo date("l, F jS \\a\\t g:i a", strtotime(ClassSession::current()->registration_starts)); ?> </strong>!</h3> <p> <?php echo CHtml::link("Class Schedule", array("/report/weekday")); ?> </p> <p> <?php echo CHtml::link("Class Descriptions", array("/report/descriptions")); ?> </p>
$isactive = 0; } ClassSession::addsessiontodatabase($_POST['session_name'], $_POST['date'], $isactive); } if (isset($_POST['u_session_name'])) { if (isset($_POST['active'])) { $isactive = 1; } else { $isactive = 0; } ClassSession::updatesession($_POST['s_id'], $_POST['u_session_name'], $_POST['date'], $isactive); } $loggedinuser = User::showmeuser($_SESSION['user_id']); //Removing a all data if (isset($_GET['conf98652'])) { ClassSession::rmvall(); $datacleared = 1; } //$myclients = Client::find_all(); // foreach($myclients as $client1){ // echo $client1->full_name(); // } include '../includes/pagestructure.php'; include '../includes/smartbanner.php'; include '../includes/smartnav.php'; adminhead('Welcome to Urban Illustration'); admintopbar(); ?> <div id="content"> <div id="maincontent">
public function defaultScope() { return array('condition' => 'session_id = ' . ClassSession::savedSessionId(), 'order' => 'check_num asc'); }
<h3>Choose class to copy from <?php echo $fromsession->summary; ?> to <?php echo ClassSession::current()->summary; ?> </h3> <?php echo CHtml::form(); echo CHtml::dropDownList('ClassInfo[id]', '', CHtml::listData(ClassInfo::model()->findAllBySql('select class_info.* from class_info where session_id = :sid', array('sid' => $fromsession->id)), 'id', 'summary'), array('submit' => '', 'empty' => 'Choose One')); echo CHtml::submitButton('Change'); echo CHtml::endForm();
public static function underAssignedChecks($session = null, $company = null) { if (!isset($session)) { $session = ClassSession::savedSessionId(); } $q = "select check_income.*\n from check_income\n left join\n (select income.check_id as check_id,\n sum(income.amount) as assigned\n from income \n group by income.check_id) as assignments\n on (assignments.check_id = check_income.id)\n where assignments.assigned < check_income.amount\n and check_income.session_id = :session"; if (isset($company)) { ///XXX hACK!, just use querybuilder will ya? $q .= " and check_income.payee_id = {$company}"; } return CheckIncome::model()->findAllBySql($q, array('session' => $session)); }
<h1> <?php echo CHtml::encode(ClassSession::current()->summary); ?> </h1> <ul> <?php foreach ($models as $model) { echo '<li><h2>' . $model->full_name . '</h2>'; $this->renderPartial('/signup/_class_summary', array('model' => $model)); echo '</li>'; } ?> </ul>
public function getOwed() { $c = Yii::app()->db->createCommand("select sum(paids.total_paid) as owed,\n paids.instructor_id\nfrom\n (select csum.total_paid,\n instructor_assignment.percentage,\n instructor_assignment.instructor_id,\n (csum.total_paid * instructor_assignment.percentage/100) as owed\n from instructor_assignment\n left join\n(select class_info.class_name,\n\t\t(sum(income.amount) - sum(signup_with_non_instructor_fees.non_instructor_total))\n as total_paid,\n income.class_id as class_id\n from income\n left join check_income\n on check_income.id = income.check_id\n left join class_info\n on class_info.id = income.class_id\n\t\t\tleft join\n (select signup.class_id, signup.status, signup.student_id,\n ifnull(non_instructor_fees.amount,0) as non_instructor_total\n from signup\n left join\n (select sum(extra_fee.amount) as amount, extra_fee.class_id as class_id\n from extra_fee\n where extra_fee.pay_to_instructor < 1\n group by extra_fee.class_id)\n as non_instructor_fees\n on non_instructor_fees.class_id = signup.class_id)\n\t\t\t\t\tas signup_with_non_instructor_fees\n on (signup_with_non_instructor_fees.class_id = income.class_id\n and signup_with_non_instructor_fees.student_id = income.student_id)\n where (check_income.returned is null\n or check_income.returned < '1999-01-01')\n and signup_with_non_instructor_fees.status = 'Enrolled'\n and class_info.session_id = :sid\n group by class_info.id\n order by class_info.class_name asc)\n\t as csum\n on csum.class_id = instructor_assignment.class_id\n where total_paid is not null) as paids\n where paids.instructor_id = :inst"); $r = $c->queryRow(true, array('inst' => $this->id, 'sid' => ClassSession::savedSessionId())); return $r['owed']; }
public static function previousPublic() { return self::model()->findBySql("select class_session.* from class_session \n where public > 0\n and id != :currentid \n order by start_date desc\n limit 1", array('currentid' => ClassSession::savedSessionId())); }
public function actionIntegrityCheck() { $unassigned = CheckIncome::model()->findAllBySql("select check_income.*\nfrom check_income\nleft join (select sum(income.amount) as total, \n income.check_id as check_id\n from income\n group by income.check_id) as assigned\non assigned.check_id = check_income.id\nwhere coalesce(assigned.total,0) != coalesce(check_income.amount,0)\nand (check_income.returned is null or check_income.returned < '2000-01-01')\nand check_income.session_id = :sid\n", array('sid' => ClassSession::savedSessionId())); $instructorbalance = ClassInfo::model()->findAllBySql("select class_info.*\nfrom class_info\nleft join (select sum(instructor_assignment.percentage) as total, \n instructor_assignment.class_id as class_id\n from instructor_assignment\n group by instructor_assignment.class_id) as assigned\non assigned.class_id = class_info.id\nwhere coalesce(assigned.total,0) != 100\nand class_info.session_id = :sid\n", array('sid' => ClassSession::savedSessionId())); $this->render('integrity_check', array('unassigned' => $unassigned, 'instructorbalance' => $instructorbalance)); }
<?php require_once "includesmain/session.php"; require_once "includesmain/functions.php"; require_once "includesmain/database.php"; require_once "includesmain/class.php"; require_once "includesmain/client.php"; require_once "includesmain/class_session.php"; require_once "securimage/securimage.php"; require_once "includesmain/datemanager.php"; $securimage = new Securimage(); $activesession = ClassSession::getactivesession(); $classtojoin = Classes::find_by_id($_GET['join']); $sessiontojoin = ClassSession::find_by_id($classtojoin->sessionid); if (isset($_POST['p_firstname'])) { if (!$securimage->check($_POST['captcha_code'])) { $captchaerror = TRUE; } else { $mailtotest = $database->escape_value($_POST['email']); $alreadyclient = Client::find_by_email($mailtotest); if ($alreadyclient) { if ($_POST['k_firstname'] == $alreadyclient->k_firstname) { $kidalreadyregistered = true; } } if (!$kidalreadyregistered) { Client::addclienttodatabase($_POST['clsid'], $_POST['p_firstname'], $_POST['p_lastname'], $_POST['k_firstname'], $_POST['k_lastname'], $_POST['phone'], $_POST['email'], $_POST['coupon']); $insertedid = $database->insert_id(); redirect_to('view-details.php?tclt=' . $insertedid . '&cls=' . $_POST['clsid']); } else { redirect_to('complete.php');
public function populate($type = 'check') { $cash_comparison = $type == 'check' ? "check_income.cash < 1" : " check_income.cash > 0"; /* XXX TODO, the rest of the criteria here! - enrolled count > minimum - income count > 1 */ $r = CheckIncome::model()->findAllBySql("\nselect check_income.*\nfrom check_income\nleft join (select sum(income.amount) as total,\n income.check_id as check_id\n from income\n group by income.check_id\n ) as income_summary\non income_summary.check_id = check_income.id\nleft join (select income.check_id as check_id,\n count(signup.class_id) as unenrolled_count\n from income\n left join signup\n on signup.class_id = income.class_id\n and signup.student_id = income.student_id\n left join (\n select count(signup.student_id) as total_enrolled,\n class_info.min_students as min,\n class_info.status as status,\n signup.class_id as class_id \n from class_info\n left join signup\n on class_info.id = signup.class_id\n where signup.status = 'Enrolled'\n group by class_id\n ) as class_summary\n on class_summary.class_id = signup.class_id\n where signup.status != 'Enrolled'\n or class_summary.total_enrolled < class_summary.min\n or class_summary.status = 'Cancelled'\n group by income.check_id\n ) as signup_status\non signup_status.check_id = check_income.id\nwhere income_summary.total = check_income.amount\n and signup_status.unenrolled_count is null\n and check_income.payee_id = :osspto\n and (check_income.deposit_id is null or check_income.deposit_id < 1)\n and ( {$cash_comparison} )\n and check_income.session_id = :sid\n and (check_income.returned is null or check_income.returned < '2000-01-01')\n", array('osspto' => Company::OSSPTO_COMPANY, 'sid' => ClassSession::savedSessionId())); foreach ($r as $i) { $i->deposit_id = $this->id; $i->save(); } }