コード例 #1
0
 /**
  * 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.
  */
 public function loadModel($id)
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Requirements::model()->findByPk($id);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
コード例 #2
0
ファイル: view.php プロジェクト: argenis1763/vc
    'onclick' => '$("#myModal").dialog("open"); return false;',
)); */
?>

<!-- Box de Students Asignados -->
<?php 
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => 'Estudiantes asignados al Requirement', 'headerIcon' => 'icon-th-list'));
$dataProvider = new CActiveDataProvider('Students', array('criteria' => array('condition' => 'requirements_id = :id', 'params' => array(':id' => $model->id))));
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataProvider, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array('id', array('header' => 'Nº de Identidad', 'value' => '$data->profile->identification'), array('name' => 'Nombre', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->profile->firstname, $data->profile->secondname, $data->profile->lastname1, $data->profile->lastname2);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data->profile->sex);
}, 'type' => 'raw'), array('header' => 'Correo', 'value' => '$data->profile->email'), array('header' => 'Status', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->validarStatus($data->profile->cruge_user_iduser);
}), array('name' => 'Requirements', 'type' => 'raw', 'value' => function ($data, $row) use($model) {
    return Requirements::model()->getLinkRequirement($model->id, $data->id);
}), array('name' => '', 'type' => 'raw', 'value' => "TbHtml::submitButton('Remover',array(\n                        'submit'=>array('remove','id'=>" . '$data->id' . "),\n\t\t\t\t\t\t'params'=>array('idx'=>{$model->id}),\n\t\t\t\t\t\t'confirm'=>'Desea remover al estudiante del Requirement?',\n                        'color'=>TbHtml::BUTTON_COLOR_DANGER,\n                        'size'=>TbHtml::BUTTON_SIZE_MINI,\n                    ))"))));
?>

<?php 
$this->endWidget();
?>
<!-- End Box de Students Asignados -->

<script>
$(document).ready(function(){
		
		$("#ocultarAdd").click(function(event){
			event.preventDefault();
			$("#informacion").hide("slow");
			$("#ocultarAdd").hide();
コード例 #3
0
?>
" />
		<input type="hidden" name="equipments_type" value="<?php 
echo $model->equipments_type;
?>
" />
		<?php 
echo $form->labelEx($model, 'requirements_id');
?>
		<?php 
//echo $form->textField($model,'requirements_id',array('size'=>10,'maxlength'=>10));
?>
		
		<?php 
//echo $form->dropDownList('EquipmentRequirements', $model->requirements_id, CHTML::listData(Requirements::model()->findAll(), 'id', 'name' ));
echo $form->dropDownList($model, 'requirements_id', CHTML::listData(Requirements::model()->findAll(), 'id', 'name'));
?>
		<?php 
echo $form->error($model, 'requirements_id');
?>
	</div>
	<div class="row buttons">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save');
?>
	</div>

<?php 
$this->endWidget();
?>
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Requirements::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * Check if a knight accomplish with requirements for item
  * @param unknown $equipment_type
  * @param unknown $identificator
  * @param unknown $knight_id
  * @return boolean
  */
 public static function checkAccomplish($equipments_type, $identificator, $knight_id)
 {
     Yii::trace('[APP] Cehck for  ' . "{$equipments_type}, {$identificator}, {$knight_id}");
     // Search all requirements
     $equipmentRequirementsList = self::model()->findAll('identificator=:identificator AND equipments_type=:equipments_type', array(':identificator' => $identificator, ':equipments_type' => $equipments_type));
     if ($equipmentRequirementsList) {
         Yii::trace('[APP] equipment requirement exist');
         // Load knight card
         $knight = Knights::model()->findByPk($knight_id);
         $knightCard = KnightsCard::model()->findByPk($knight_id);
         // Check for each requirement if knight accomplish with it
         // Check if all requirements are accomplish. Load requirements
         foreach ($equipmentRequirementsList as $equipmentRequirements) {
             Yii::trace('[APP] check requirement ' . $equipmentRequirements->requirements_id);
             // Load requirement
             $requirement = Requirements::model()->findByPk($equipmentRequirements->requirements_id);
             Yii::trace('[APP] Load requirement ' . $requirement->id . ': ' . $requirement->level . ' - ' . $requirement->attribute . ' - ' . $requirement->skill);
             // Check level
             if ($requirement->level != null && $requirement->value > $knight->level) {
                 Yii::trace('[APP] No level');
                 return false;
             } else {
                 if ($requirement->attribute != null) {
                     Yii::trace('[APP] Is attribute');
                     // Load name of characteristic
                     $attributeName = Constants::model()->findByPk($requirement->attribute);
                     if ($requirement->value > $knightCard->{$attributeName->name}) {
                         Yii::trace('[APP] NO attribute');
                         return false;
                     }
                 } else {
                     if ($requirement->skill != null) {
                         Yii::trace('[APP] Is skill');
                         $attributeName = Constants::model()->findByPk($requirement->skill);
                         if ($requirement->value > $knightCard->{$attributeName->name}) {
                             Yii::trace('[APP] No skill');
                             return false;
                         }
                     }
                 }
             }
             Yii::trace('[APP] requirement pass');
         }
     }
     Yii::trace('[APP] F**k yeah');
     return true;
 }
コード例 #6
0
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('identificator'));
?>
:</b>
	<?php 
echo CHtml::encode($data->identificator);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('equipments_type'));
?>
:</b>
	<?php 
echo CHtml::encode($data->equipments_type);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('requirements_id'));
?>
:</b>
	<?php 
echo CHtml::encode(Requirements::model()->findByPk($data->requirements_id)->name);
?>
	<br />


</div>
コード例 #7
0
 public function actionInventory()
 {
     //Almacenamos los datos de la plantilla
     $data = array();
     //Check input
     if (isset($_GET['sir']) && $_GET['sir'] != '') {
         if (!($knight = Yii::app()->cache->get(Yii::app()->params['cacheKeys']['knights_by_name'] . $_GET['sir']))) {
             $knight = Knights::model()->find('name=:name', array(':name' => $_GET['sir']));
             if ($knight) {
                 Yii::app()->cache->set(Yii::app()->params['cacheKeys']['knights_by_name'] . $_GET['sir'], $knight, Yii::app()->params['cachetime']['knight']);
             }
         }
         if ($knight) {
             //datos del caballero
             $data['knight'] = $knight;
             //cargamos el inventario del caballero
             $item_list = Inventory::model()->findAll('knights_id=:knights_id', array(':knights_id' => $knight->id));
             $inventory = array();
             foreach ($item_list as $item) {
                 switch ($item->type) {
                     case Inventory::EQUIPMENT_TYPE_ARMOUR:
                         $armours_object = ArmoursObjects::model()->with(array('armours' => array('with' => array('type0', 'armoursMaterials', 'equipmentSize', 'equipmentQualities', 'equipmentRarity'))))->find('t.id=:id', array(':id' => $item->identificator));
                         $item_info['armours_id'] = $armours_object->armours->id;
                         $item_info['name'] = $armours_object->armours->name;
                         $item_info['armoursPDE'] = $armours_object->armours->pde;
                         $item_info['current_pde'] = $armours_object->current_pde;
                         $item_info['armours_type_name'] = $armours_object->armours->type0->name;
                         $item_info['armoursMaterialName'] = $armours_object->armours->armoursMaterials->name;
                         $item_info['armoursMaterialEndurance'] = $armours_object->armours->armoursMaterials->endurance;
                         $item_info['armoursMaterialPrize'] = $armours_object->armours->armoursMaterials->prize;
                         $item_info['armoursMaterialName'] = $armours_object->armours->armoursMaterials->name;
                         $item_info['equipmentSizeName'] = $armours_object->armours->equipmentSize->name;
                         $item_info['equipmentQualitiesName'] = $armours_object->armours->equipmentQualities->name;
                         $item_info['equipmentRarityName'] = $armours_object->armours->equipmentRarity->name;
                         // Load requirements
                         if ($equipmentRequirements_list = EquipmentRequirements::model()->findAll('identificator=:identificator AND equipments_type=:equipments_type', array(':identificator' => $armours_object->armours->id, ':equipments_type' => Inventory::EQUIPMENT_TYPE_ARMOUR))) {
                             // Load all requirement
                             $item_info['requirement_list'] = array();
                             foreach ($equipmentRequirements_list as $equipmentRequirements) {
                                 $item_info['requirement_list'][] = Requirements::model()->findByPk($equipmentRequirements->requirements_id);
                             }
                         } else {
                             // No rquirement
                             $item_info['requirement_list'] = null;
                         }
                         $template = 'armour';
                         break;
                     case Inventory::EQUIPMENT_TYPE_SPEAR:
                         $spears_object = SpearsObjects::model()->with(array('spears' => array('with' => array('equipmentQualities', 'equipmentRarity', 'equipmentSize', 'spearsMaterials', 'spearsObjects'))))->find('t.id=:id', array(':id' => $item->identificator));
                         $item_info['spears_id'] = $spears_object->spears->id;
                         $item_info['name'] = $spears_object->spears->name;
                         $item_info['PDE'] = $spears_object->spears->pde;
                         $item_info['current_pde'] = $spears_object->current_pde;
                         $item_info['spears_damage'] = $spears_object->spears->damage;
                         $item_info['spearPrize'] = $spears_object->spears->prize;
                         $item_info['spearsMaterialName'] = $spears_object->spears->spearsMaterials->name;
                         $item_info['equipmentQualitiesName'] = $spears_object->spears->equipmentQualities->name;
                         $item_info['equipmentSizeName'] = $spears_object->spears->equipmentSize->name;
                         $item_info['equipmentRarityName'] = $spears_object->spears->equipmentRarity->name;
                         // Load requirements
                         if ($equipmentRequirements_list = EquipmentRequirements::model()->findAll('identificator=:identificator AND equipments_type=:equipments_type', array(':identificator' => $spears_object->spears->id, ':equipments_type' => Inventory::EQUIPMENT_TYPE_SPEAR))) {
                             // Load all requirement
                             $item_info['requirement_list'] = array();
                             foreach ($equipmentRequirements_list as $equipmentRequirements) {
                                 $item_info['requirement_list'][] = Requirements::model()->findByPk($equipmentRequirements->requirements_id);
                             }
                         } else {
                             // No rquirement
                             $item_info['requirement_list'] = null;
                         }
                         $template = 'spear';
                         break;
                     case Inventory::EQUIPMENT_TYPE_TRICK:
                         //FALTA DEFINIR LOS TRICKS!!
                         $template = 'trick';
                         break;
                 }
                 $data_template = array('item' => $item, 'item_info' => $item_info);
                 $inventory[$item->position] = $this->renderFile(Yii::app()->basePath . '/views/character/item_' . $template . '.php', $data_template, true);
             }
             $data['inventory'] = $inventory;
             //Load knights_status template
             //$data['knights_status_template'] = $this->renderFile(  Yii::app()->basePath.'/views/character/knights_status.php', array('knight'=>$knight), true );
             //Datos del caballero del usuario
             $data['user_data'] = $this->user_data;
             $this->render('inventory', $data);
         } else {
             //User not valid
             $this->redirect(array('error'));
         }
     } else {
         //Input no valid
         //echo 'El nombre de usuario NO es válido.';
         $this->redirect(array('error'));
     }
 }
コード例 #8
0
ファイル: report.php プロジェクト: argenis1763/vc
<?php

/* @var $this GenerateController */
# render (full page)
if (isset($_GET['idr']) && isset($_GET['ids'])) {
    $student = Students::model()->findByPk($_GET['ids']);
    $model = Requirements::model()->findByPk($_GET['idr']);
} else {
    $this->redirect(array('requirements/index'));
}
$colleges_name = $model->colleges->name;
$title_d = 0;
$title_a = 0;
$title_ap = 0;
$title_n = 0;
//Configuracion
$mPDF1 = Yii::app()->ePdf->mpdf();
$mPDF1 = Yii::app()->ePdf->mpdf('utf-8', 'Letter');
//Cabeceras
$mPDF1->SetTitle('Requirements Report');
$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/via-college-pdf.css');
$mPDF1->WriteHTML($stylesheet, 1);
?>

<?php 
$mPDF1->WriteHTML("<div>");
$mPDF1->WriteHTML("<div><img src='" . Yii::app()->theme->baseUrl . "/img/logos/logo-requisito.png'/></div>");
$mPDF1->WriteHTML("<div></div>");
$mPDF1->WriteHTML("<div><table><tbody><tr><td class='title-college'>" . $colleges_name);
foreach ($model->requirementsHasRequirementsFields as $id => $requirementsHasRequirementsField) {
    ?>