예제 #1
0
 /**
  * Returns instance of the renderer
  *
  * @param  string            $name Name of the renderer
  * @return IRenderer Renderer instance
  *
  * @throws InvalidArgumentException If the renderer with given name does not exist
  */
 public function getRenderer($name)
 {
     // default
     if ($name === null) {
         if ($this->defaultRenderer !== null) {
             $name = $this->defaultRenderer;
         } else {
             if (count($this->renderers) > 0) {
                 $name = key($this->renderers);
             }
         }
     }
     if (!isset($this->renderers[$name])) {
         throw new InvalidArgumentException("Renderer with name '{$name}' doesn't exist.");
     }
     if (is_string($this->renderers[$name])) {
         $renderer = new $this->renderers[$name]();
         $reflection = ClassType::from($renderer);
         if (!$reflection->isSubclassOf('Smf\\Menu\\Renderer\\IRenderer')) {
             throw new InvalidArgumentException("Renderer class '{$this->renderers[$name]}' is not subclass of Smf\\Menu\\Renderer\\IRenderer");
         }
         $this->renderers[$name] = $renderer;
     }
     return $this->renderers[$name];
 }
예제 #2
0
 public static function createFromName(string $name) : Type
 {
     $name = str_replace('/', '\\', $name);
     if ('' === $name) {
         throw new \Exception('ERR 34145234: Params without classes are not supported yet!');
     }
     if ('string' === $name) {
         return new StringType();
     } elseif ('array' === $name) {
         return new ArrayType();
     } elseif ('int' === $name) {
         return new IntType();
     } elseif ('float' === $name) {
         return new FloatType();
     } elseif ('bool' === $name) {
         return new BoolType();
     }
     return ClassType::create($name);
 }
예제 #3
0
<?php

/* @var $this ScheduleController */
/* @var $model Schedule */
/* @var $form CActiveForm */
$dataProgram = Programs::model()->findAll();
$optionArrayPrograms = CHtml::listData($dataProgram, 'program_Id', 'program_Name');
$dataProfessor = Professors::model()->findAll();
$professorData = CHtml::listData($dataProfessor, 'professor_Id', 'fullName');
$roomData = ClassType::model()->with('room')->findAll();
$roomArray = CHtml::listData($roomData, 'class_Type_Id', 'room.room_Number');
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'schedule-form', 'enableAjaxValidation' => false));
$ajax = array('type' => 'GET', 'url' => $this->createUrl('schedule/getProfessorCource'), 'data' => array('id' => 'js:$(this).val()'), 'update' => '#Schedule_professor_Course_Id');
$ajax2 = array('type' => 'GET', 'url' => $this->createUrl('schedule/getClassType'), 'data' => array('id' => 'js:$(this).val()'), 'update' => '#Schedule_class_Type_Id');
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary(array($model, $model2));
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'program_Id');
?>
 /**
  * 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 $id the ID of the model to be loaded
  * @return ClassType the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ClassType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionGetClassType($id)
 {
     $day = date('l', strtotime($id));
     $raj = ClassType::model()->with('room')->findAllByAttributes(array('day' => $day));
     $returnData = CHtml::listData($raj, 'class_Type_Id', 'concatened');
     $html = "";
     foreach ($returnData as $k => $val) {
         $html .= "<option value='" . $k . "'>" . $val . "</option>";
     }
     echo $html;
     exit;
 }
예제 #6
0
<?php 
/* @var $this ScheduleController */
/* @var $model Schedule */
/* @var $form CActiveForm */
$dataProgram = Programs::model()->findAll();
$optionArrayPrograms = CHtml::listData($dataProgram, 'program_Id', 'program_Name');
$dataProfessor = Professors::model()->findAll();
$professorData = CHtml::listData($dataProfessor, 'professor_Id', 'fullName');
$roomData = ClassType::model()->with('room')->findAll();
$roomArray = CHtml::listData($roomData, 'class_Type_Id', 'room.room_Number');
$classData = ClassType::model()->findAll();
$classTypeData = CHtml::listData($classData, 'class_Type_Id', 'concatened');
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'schedule-form', 'enableAjaxValidation' => false));
$ajax = array('type' => 'GET', 'url' => $this->createUrl('schedule/getProfessorCource'), 'data' => array('id' => 'js:$(this).val()'), 'update' => '#Schedule_professor_Course_Id');
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary(array($model, $model2));
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'program_Id');