public function createDepartment()
 {
     $validator = Validator::make(Input::all(), array('name' => 'required', 'shortname' => 'required', 'head' => 'required', 'description' => 'required', 'facultyId' => 'required|numeric'));
     if ($validator->fails()) {
         // If not inform user of errors.
         return Response::json(array('success' => false, 'errors' => $validator->messages()));
     } else {
         // Check user has permission to create department.
         if (Auth::user()->rank == 3) {
             // Now just create Department.
             $department = Departments::create(array('departmentname' => Input::get('name'), 'departmentshort' => Input::get('shortname'), 'departmenthead' => Input::get('head'), 'departmentdescription' => Input::get('description'), 'facultyid' => Input::get('facultyId')));
             // Get faculty list so we can return with response.
             $faculties = Faculty::all();
             // If not inform user of errors.
             return Response::json(array('success' => true, 'departmentId' => $department->departmentid, 'faculties' => $faculties));
         }
     }
 }
예제 #2
0
<?php

/* @var $this GroupController */
/* @var $model Group */
$this->breadcrumbs = array('Groups' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Group', 'url' => array('index')), array('label' => 'Create Group', '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\$('#group-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage Groups</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'group-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id' => ['name' => 'id', 'htmlOptions' => ['width' => 30]], 'name', 'faculty_id' => ['name' => 'faculty_id', 'value' => '$data->faculty->name', 'filter' => Faculty::all()], 'direction_id' => ['name' => 'direction_id', 'value' => '$data->direction->name', 'filter' => Direction::all()], array('class' => 'CButtonColumn'))));
예제 #3
0
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 50));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'faculty_id');
?>
		<?php 
echo $form->dropDownList($model, 'faculty_id', Faculty::all());
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton('Search');
?>
	</div>

<?php 
$this->endWidget();
?>

</div><!-- search-form -->
<?php

ob_start();
$faculties = Faculty::all();
$programmes = Programme::all();
$races = Student::races();
?>
	
	<div class="text-center">
		<h1><?php 
echo APPNAME;
?>
</h1>
		<hr />
	</div>
	
	<div class="row">
		<div class="col-md-6 col-sm-6 col-xs-12">
			<div class="text-center">
				<a href="#student-login" data-toggle="modal">
					<span style="font-size:32px"><i class="fa fa-user"></i></span>
					<h2>Pelajar</h2>
				</a>
			</div>
		</div>
		<div class="col-md-6 col-sm-6 col-xs-12">
			<div class="text-center">
				<a href="#administrator-login" data-toggle="modal">
					<span style="font-size:32px"><i class="fa fa-key"></i></span>
					<h2>Penyelaras</h2>
				</a>