Exemplo n.º 1
0
 public static function ver($base = true, $echo = true)
 {
     if ($base) {
         Center::base();
     }
     //------------------------------------------------
     $string = "top:0;\n\t\tbottom:0;";
     //------------------------------------------------
     if ($echo) {
         echo $string;
     } else {
         return $string;
     }
 }
Exemplo n.º 2
0
echo $form->labelEx($model, 'tid');
?>
        <?php 
echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'tid');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'cid');
?>
        <?php 
echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'cid');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'start_time');
?>
        <?php 
//echo $form->textField($model, 'start_time');
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'ClassGuitar[start_time]', 'language' => 'vi', 'options' => array('showAnim' => 'fold'), 'value' => date('d/m/Y', $model->start_time ? $model->start_time : time()), 'htmlOptions' => array('style' => 'height:20px;')));
?>
        <?php 
Exemplo n.º 3
0
//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
//============================================================================================
// Model
//============================================================================================
$user = new User($dbo);
$centre = new Center($dbo);
//============================================================================================
// Load the page requested by the user
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = 'user';
    $users = $user->listUsers();
    $centres = $centre->listCentres();
    $l10n->addResource(__DIR__ . '/l10n/global-mentoring.json');
    $l10n->addResource(__DIR__ . '/l10n/user.json');
    $viewFile = 'views/user.php';
}
/**
 * View rendering
 */
Exemplo n.º 4
0
 public function actionRegister()
 {
     $arrayAuthRoleItems = Yii::app()->authManager->getAuthItems(2, Yii::app()->user->getId());
     $arrayKeys = array_keys($arrayAuthRoleItems);
     $role = strtolower($arrayKeys[0]);
     if ($role == 'admin' || $role == 'teacher') {
         $this->redirect('/');
     }
     $this->layout = 'dangkyhoc';
     $model = new Student();
     if (isset($_GET['cid']) && (int) $_GET['cid']) {
         $model->class_id = $_GET['cid'];
     }
     $db = Yii::app()->db;
     if (isset($_POST['Student']) && $_POST['Student']) {
         $model->setAttributes($_POST['Student']);
         $gclass = ClassGuitar::model()->findByPk($model->class_id);
         $sql = "SELECT * FROM {{student}} WHERE user_id =" . Yii::app()->user->id . " ORDER BY id DESC";
         $cmd = $db->createCommand($sql);
         $student = $cmd->queryRow();
         if ($student) {
             //                var_dump($studentơclass_id);
             $gclass2 = ClassGuitar::model()->findByPk($student['class_id']);
             if ($student['status'] == 'comp') {
                 //Hoàn thành
                 if ($gclass->tid <= $gclass2->tid) {
                     $training = Training::model()->findByPk($gclass2->tid);
                     Yii::app()->user->setFlash('error', 'Bạn đã hoàn thành một lớp thuộc khóa <b>' . $training->title . '</b>. Vui lòng đăng ký khóa học cao hơn.');
                 }
             } elseif ($student['status'] == 'reg') {
                 // Mới đăng ký
                 Yii::app()->user->setFlash('error', 'Bạn đã đăng ký học tại lớp <b>' . $gclass2->title . '</b>. Vui lòng hủy đơn đăng ký này trước khi đăng ký tham gia lớp học khác!');
             } else {
                 $center = Center::model()->findByPk($gclass2->cid);
                 Yii::app()->user->setFlash('error', 'Bạn đang tham gia lớp học <b>' . $gclass2->title . '</b> tại cơ sở <b>' . $center->title . '</b>!');
             }
         } else {
         }
         if (!Yii::app()->user->hasFlash('error') && $model->save()) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 Yii::app()->user->setFlash('success', 'Bạn đã đăng ký lớp học thành công. LNT sẽ sớm liên lạc lại với bạn.');
             }
         }
     } else {
         $oldStudent = Student::model()->find('user_id=' . Yii::app()->user->id);
         if ($oldStudent) {
             $model->name = $oldStudent->name;
             $model->email = $oldStudent->email;
             $model->tel = $oldStudent->tel;
             $model->birthday = $oldStudent->birthday;
         }
     }
     $this->render('register', array('model' => $model));
 }
Exemplo n.º 5
0
<?php

$this->breadcrumbs = array('Lớp học' => array('admin'), 'Quản lý');
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('class-guitar-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Các lớp học</h1>
<?php 
echo GxHtml::link(Yii::t('app', 'Tìm kiếm'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
    <?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'class-guitar-grid', 'dataProvider' => $model->search(), 'columns' => array('sku', 'title', array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Training::model()->findAllAttributes(null, true))), array('name' => 'cid', 'value' => 'GxHtml::valueEx($data->c)', 'filter' => GxHtml::listDataEx(Center::model()->findAllAttributes(null, true))), array('name' => 'start_time', 'value' => 'date("d/m/Y",$data->start_time)'), array('name' => 'end_time', 'value' => 'date("d/m/Y",$data->end_time)'), array('class' => 'CButtonColumn'))));
Exemplo n.º 6
0
function getCenters()
{
    include "center.php";
    $obj = new Center();
    if (!$obj->getCenters()) {
        echo '{"result":0,"message": "failed to display"}';
        return;
    }
    //at this point the search has been successful.
    //generate the JSON message to echo to the browser
    $row = $obj->fetch();
    echo '{"result":1,"centers":[';
    //start of json object
    while ($row) {
        echo json_encode($row);
        //convert the result array to json object
        $row = $obj->fetch();
        if ($row) {
            echo ",";
            //if there are more rows, add comma
        }
    }
    echo "]}";
}
Exemplo n.º 7
0
 public function editMember($member_id)
 {
     $member = Member::find($member_id);
     $cities = ["" => "select"] + City::get_city_array();
     $centers = ["" => "select"] + Center::get_center_array();
     $member_types = ["" => "select"] + Member::member_types();
     $states = States::state_list();
     return html_entity_decode(View::make('admin.manage.members.add', ["member" => $member, "centers" => $centers, "cities" => $cities, "states" => $states, 'member_types' => $member_types]));
 }
Exemplo n.º 8
0
<?php

$this->breadcrumbs = array(Center::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Center::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Center::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Center::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
Exemplo n.º 9
0
	<div class="row">
		<?php 
echo $form->label($model, 'tid');
?>
		<?php 
echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn loại khóa học--')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'cid');
?>
		<?php 
echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn trung tâm--')));
?>
	</div>

	<!--<div class="row">
		<?php 
/*echo $form->label($model, 'start_time'); */
?>
		<?php 
/*echo $form->textField($model, 'start_time'); */
?>
	</div>

	<div class="row">
		<?php 
/*echo $form->label($model, 'create_time'); */
Exemplo n.º 10
0
 public static function get_center_array()
 {
     return Center::lists('center_name', 'id');
 }
Exemplo n.º 11
0
 public function getCenter()
 {
     $id = Input::get('city');
     $centers = Center::where('city_id', $id)->lists('center_name', 'id');
     $final_list = [];
     foreach ($centers as $key => $value) {
         array_push($final_list, array("id" => $key, "value" => $value));
     }
     $data['success'] = 'true';
     $data['message'] = $final_list;
     return json_encode($data);
 }
Exemplo n.º 12
0
 /**
  * @before _secure, _vendor
  */
 public function update($id)
 {
     $this->seo(array("title" => "Edit Lab", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre = Centre::first(array("id = ?" => $id));
     if (RequestMethods::get("live")) {
         $centre->live = RequestMethods::get("live", 0);
         $centre->save();
         $this->redirect("/lab/manage");
     }
     $location = Location::first(array("id = ?" => $centre->location_id));
     $areas = Area::all(array("city_id = ?" => $location->city_id), array("name", "id"));
     $manager = User::first(array("id = ?" => $this->member->user_id));
     if (RequestMethods::post("action") == "medicallab") {
         $message = null;
         $location->street = RequestMethods::post("street");
         $location->area_id = RequestMethods::post("area_id");
         $location->city_id = RequestMethods::post("city_id");
         if ($location->validate()) {
             $location->save();
         } else {
             $message = "Center location was not saved!!";
         }
         $phone = RequestMethods::post("phone");
         if ($phone != $centre->phone) {
             $exist = Center::first(array("phone = ?" => $phone));
             if ($exist) {
                 $message = "Phone number already exists";
             } else {
                 $centre->phone = $phone;
                 $centre->save();
             }
         }
         if (!$message) {
             $message = "Lab info updated!!";
         }
         $view->set("message", $message);
     }
     if (RequestMethods::post("action") == "operations") {
         $operations = RequestMethods::post("operations");
         foreach ($operations as $key => $value) {
             $operation = Operation::first(array("centre_id = ?" => $id, "area_id = ?" => $value));
             if (!$operation) {
                 $operation = new Operation(array("user_id" => $this->user->id, "centre_id" => $id, "organization_id" => $this->organization->id, "area_id" => $value, "live" => 1));
                 $operation->save();
             }
         }
     }
     $ops = Operation::all(array("centre_id = ?" => $id), array("area_id"));
     $opa = array();
     foreach ($ops as $o) {
         $opa[] = $o->area_id;
     }
     $view->set("centre", $centre);
     $view->set("manager", $manager);
     $view->set("location", $location);
     $view->set("areas", $areas);
     $view->set("opa", $opa);
 }
Exemplo n.º 13
0
 public function showCenterReport($city_id, $center_id)
 {
     $cities = City::where('id', '<=', '25')->orderby('name', 'ASC')->get();
     $centers = Center::where('city_id', '=', $city_id)->where('status', '=', 1)->orderby('name', 'ASC')->get();
     $tables = DB::table('Student')->join('propel_student_wingman as B', 'Student.id', '=', 'B.student_id')->join('User as C', 'C.id', '=', 'B.wingman_id')->join('Center as D', 'D.id', '=', 'Student.center_id')->join('City as E', 'E.id', '=', 'D.city_id');
     $child_data = $tables->select('Student.id as id', 'Student.name as name', 'C.name as wingman_name', 'D.id as center_id', 'D.name as center_name', 'E.name as city_name', 'E.id as city_id')->distinct()->where('E.id', '=', $city_id)->orderby('D.name', 'ASC')->where('D.id', '=', $center_id)->get();
     //$child_data = $tables->select('Student.name as name','C.name as wingman_name','D.id as center_id','D.name as center_name','E.name as city_name','E.id as city_id','F.id','F.id as journal_count','G.id as event_count')->distinct()->where('E.id','=',$city_id)->where('F.type','=','child_feedback')->orderby('D.name','ASC')->get(); //Test Query
     $child_data = (array) $child_data;
     $total = array();
     $total['wingman_session_count'] = 0;
     $total['asv_session_count'] = 0;
     $total['journal_count'] = 0;
     foreach ($child_data as $child) {
         $calendarEvent = CalendarEvent::where('student_id', '=', $child->id)->where('status', '<>', 'cancelled')->where('type', '=', 'wingman_time')->get();
         $child->wingman_session_count = count($calendarEvent);
         $total['wingman_session_count'] += $child->wingman_session_count;
         $calendarEvent = DB::table('propel_calendarEvents as A')->join('propel_wingmanTimes as B', 'A.id', '=', 'B.calendar_event_id')->where('A.student_id', '=', $child->id)->where('A.status', '=', 'attended')->get();
         $child->wingman_module_attended = count($calendarEvent);
         $calendarEvent = CalendarEvent::where('student_id', '=', $child->id)->where('status', '<>', 'cancelled')->where('type', '=', 'volunteer_time')->get();
         $child->asv_session_count = count($calendarEvent);
         $total['asv_session_count'] += $child->asv_session_count;
         $journalEntry = WingmanJournal::where('student_id', '=', $child->id)->where('type', '=', 'child_feedback')->get();
         $child->journal_count = count($journalEntry);
         $total['journal_count'] += $child->journal_count;
     }
     return View::make('reports.child-report.city-report')->with('child_data', $child_data)->with('cities', $cities)->with('city_id', $city_id)->with('centers', $centers)->with('center_id', '0')->with('total', $total);
 }
Exemplo n.º 14
0
namespace Ventus\Mentoring;

//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
//============================================================================================
// Model
//============================================================================================
$centre = new Center($dbo);
//============================================================================================
// Load the page requested by the user
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = 'centre';
    $allCentres = $centre->listCentres();
    $l10n->addResource(__DIR__ . '/l10n/global-mentoring.json');
    $l10n->addResource(__DIR__ . '/l10n/center.json');
    $viewFile = 'views/center.php';
} elseif ($_GET['page'] === "fetch-centre") {
    $fetch = $centre->fetchCentre($_POST['center_id']);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($fetch);
    exit;