本文整理汇总了PHP中Constants::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Constants::model方法的具体用法?PHP Constants::model怎么用?PHP Constants::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Constants
的用法示例。
在下文中一共展示了Constants::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
/**
* Before action load knight data of user
* @param unknown_type $action
*/
public function beforeAction($action)
{
//Load user's knight data
if (!Yii::app()->user->isGuest) {
$this->user_data['knights'] = Knights::model()->with('knightsCard', 'knightsStats')->find('id=:id', array(':id' => Yii::app()->user->knights_id));
$this->user_data['knights_card'] =& $this->user_data['knights']->knightsCard;
//Load stats of knight
$this->user_data['knights_stats'] =& $this->user_data['knights']->knightsStats;
//Load if user has new friendship request
$sql = 'SELECT friends.id as id, k1.name as name, k1.avatars_id as avatars_id FROM friends
INNER JOIN users ON users.id = friends.from_user
INNER JOIN knights as k1 ON k1.users_id = users.id
WHERE friends.status = :status AND to_user = :users_knights_id1
ORDER BY start_date DESC';
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(':status', Friends::STATUS_ONWAITING, PDO::PARAM_INT);
$command->bindValue(':users_knights_id1', $this->user_data['knights']->id, PDO::PARAM_INT);
$this->user_data['knights_new_friends'] = $command->queryAll();
//Load last messages
$this->user_data['new_messages'] = Messages::getNewMessages(Yii::app()->user->users_id);
//Load all attributes name attributes
$this->app_data['attribute_list'] = Constants::model()->findAll('type=:type', array(':type' => Constants::KNIGHTS_ATTRIBUTES));
}
return true;
}
示例2: actionGo
public function actionGo()
{
if (isset($_POST)) {
$val = $_POST['constant'];
Constants::model()->setCvalue('dayup', $val);
}
$this->render('go', array('model' => $val));
}
示例3: init
public function init()
{
$this->n_str = Constants::model()->getCvalue('nstr_'.Yii::app()->user->uid);
$this->n_fin = Constants::model()->getCvalue('nfin_'.Yii::app()->user->uid);
$this->n_nom = Constants::model()->getCvalue('nnom_'.Yii::app()->user->uid);
$this->n_art = Constants::model()->getCvalue('nart_'.Yii::app()->user->uid);
$this->n_quant = Constants::model()->getCvalue('nquant_'.Yii::app()->user->uid);
$this->n_price = Constants::model()->getCvalue('nprice_'.Yii::app()->user->uid);
$this->department = Constants::model()->getCvalue('dep_'.Yii::app()->user->uid);
$this->client = Constants::model()->getCvalue('cli_'.Yii::app()->user->uid);
}
示例4: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Requirements'])) {
// Set NUll value
foreach ($_POST['Requirements'] as $key => $value) {
if (empty($value)) {
$_POST['Requirements'][$key] = null;
}
}
$model->attributes = $_POST['Requirements'];
//die(var_export($_POST['Requirements'],true));
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array('model' => $model, 'attributeList' => Constants::model()->findAll('type=:type', array(':type' => Constants::KNIGHTS_ATTRIBUTES)), 'skillList' => Constants::model()->findAll('type=:type', array(':type' => Constants::KNIGHTS_SKILLS))));
}
示例5: actionIndex
public function actionIndex()
{
$modelff = new FileRead();
if (isset($_POST['TmpXml'])) {
$model = $_POST['TmpXml'];
$res = $this->writesimple($model);
$this->render('result', array('model' => $res));
} else {
if (isset($_POST['FileRead'])) {
$modelff->attributes = $_POST['FileRead'];
if (!$modelff->validate()) {
$this->render('fform', array('model' => $modelff));
return;
}
$modelff->image = CUploadedFile::getInstance($modelff, 'image');
if (is_object($modelff->image)) {
// $path=Yii::app()->params['load_xml'];
$path = 'docs/go.csv';
$modelff->image->saveAs($path);
}
$thefile = Yii::app()->params['load_csv'];
$ii = $this->readsimple($thefile, $modelff);
// $model=new TmpXml('search');
$doc = new TmpDocd('search');
// $this->render('admin',array('model'=>$model,'doc'=>$doc,'rr'=>$ii));
Constants::model()->setCvalue('nstr_' . Yii::app()->user->uid, $modelff->n_str);
Constants::model()->setCvalue('nfin_' . Yii::app()->user->uid, $modelff->n_fin);
Constants::model()->setCvalue('nnom_' . Yii::app()->user->uid, $modelff->n_nom);
Constants::model()->setCvalue('nart_' . Yii::app()->user->uid, $modelff->n_art);
Constants::model()->setCvalue('nquant_' . Yii::app()->user->uid, $modelff->n_quant);
Constants::model()->setCvalue('nprice_' . Yii::app()->user->uid, $modelff->n_price);
Constants::model()->setCvalue('dep_' . Yii::app()->user->uid, $modelff->department);
Constants::model()->setCvalue('cli_' . Yii::app()->user->uid, $modelff->client);
$this->render('admin', array('model' => $doc));
} else {
$this->render('fform', array('model' => $modelff));
}
}
}
示例6: actionIndex
public function actionIndex()
{
//Init
$data = array('defaultValues' => array('inventory_type' => Inventory::EQUIPMENT_TYPE_ARMOUR, 'spear_name' => null, 'spear_material' => null, 'spear_equipment_size' => null, 'spear_equipment_quality' => null, 'spear_equipment_rarity' => null, 'spear_damage_min' => null, 'spear_damage_max' => null, 'spear_pde_min' => null, 'spear_pde_max' => null, 'spear_prize_min' => null, 'spear_prize_max' => null, 'armour_name' => null, 'armour_material' => null, 'armour_equipment_size' => null, 'armour_equipment_quality' => null, 'armour_equipment_rarity' => null, 'armour_endurance_min' => null, 'armour_endurance_max' => null, 'armour_pde_min' => null, 'armour_pde_max' => null, 'armour_prize_min' => null, 'armour_prize_max' => null, 'armour_type' => null), 'result' => array());
//Check input filter
if (isset($_POST['inventory_type']) && is_numeric($_POST['inventory_type'])) {
$data['defaultValues']['inventory_type'] = $_POST['inventory_type'];
//For search
$conditions = '1=1 ';
$params = array();
switch ($_POST['inventory_type']) {
case Inventory::EQUIPMENT_TYPE_ARMOUR:
if (isset($_POST['armour_name']) && $_POST['armour_name'] != '') {
$data['defaultValues']['armour_name'] = $_POST['armour_name'];
$conditions .= 'AND name like :name ';
$params[':name'] = '%' . $_POST['armour_name'] . '%';
}
if (isset($_POST['armour_material']) && is_numeric($_POST['armour_material'])) {
$data['defaultValues']['armour_material'] = $_POST['armour_material'];
$conditions .= 'AND armours_materials_id = :armours_materials_id ';
$params[':armours_materials_id'] = $_POST['armour_material'];
}
if (isset($_POST['armour_equipment_size']) && is_numeric($_POST['armour_equipment_size'])) {
$data['defaultValues']['armour_equipment_size'] = $_POST['armour_equipment_size'];
$conditions .= 'AND equipment_size_id = :equipment_size_id ';
$params[':equipment_size_id'] = $_POST['armour_equipment_size'];
}
if (isset($_POST['armour_equipment_quality']) && is_numeric($_POST['armour_equipment_quality'])) {
$data['defaultValues']['armour_equipment_quality'] = $_POST['armour_equipment_quality'];
$conditions .= 'AND armour_equipment_size_id = :armour_equipment_size_id ';
$params[':armour_equipment_size_id'] = $_POST['armour_equipment_quality'];
}
if (isset($_POST['armour_equipment_rarity']) && is_numeric($_POST['armour_equipment_rarity'])) {
$data['defaultValues']['armour_equipment_rarity'] = $_POST['armour_equipment_rarity'];
$conditions .= 'AND equipment_rarity_id = :equipment_rarity_id ';
$params[':equipment_rarity_id'] = $_POST['armour_equipment_quality'];
}
if (isset($_POST['armour_endurance_min']) && is_numeric($_POST['armour_endurance_min'])) {
$data['defaultValues']['armour_endurance_min'] = $_POST['armour_endurance_min'];
$conditions .= 'AND endurance >= :endurance_min ';
$params[':endurance_min'] = $_POST['armour_endurance_min'] - 1 < 0 ? 0 : $_POST['armour_endurance_min'] - 1;
//Calcula min
}
if (isset($_POST['armour_endurance_max']) && is_numeric($_POST['armour_endurance_max'])) {
$data['defaultValues']['armour_endurance_max'] = $_POST['armour_endurance_max'];
$conditions .= 'AND endurance <= :endurance_max ';
$params[':endurance_max'] = $_POST['armour_endurance_max'] - 10 < 0 ? 0 : $_POST['armour_endurance_max'] - 10;
//Calculate max
}
if (isset($_POST['armour_pde_min']) && is_numeric($_POST['armour_pde_min'])) {
$data['defaultValues']['armour_pde_min'] = $_POST['armour_pde_min'];
$conditions .= 'AND pde >= :pde_min ';
$params[':pde_min'] = $_POST['armour_pde_min'];
}
if (isset($_POST['armour_pde_max']) && is_numeric($_POST['armour_pde_max'])) {
$data['defaultValues']['armour_pde_max'] = $_POST['armour_pde_max'];
$conditions .= 'AND pde <= :pde_max ';
$params[':pde_max'] = $_POST['armour_pde_max'];
}
if (isset($_POST['armour_prize_min']) && is_numeric($_POST['armour_prize_min'])) {
$data['defaultValues']['armour_prize_min'] = $_POST['armour_prize_min'];
$conditions .= 'AND prize >= :prize_min ';
$params[':prize_min'] = $_POST['armour_prize_min'];
}
if (isset($_POST['armour_prize_max']) && is_numeric($_POST['armour_prize_max'])) {
$data['defaultValues']['armour_prize_max'] = $_POST['armour_prize_max'];
$conditions .= 'AND prize <= :pde_max ';
$params[':pde_max'] = $_POST['armour_prize_max'];
}
if (isset($_POST['armour_type']) && is_numeric($_POST['armour_type'])) {
$data['defaultValues']['armour_type'] = $_POST['armour_type'];
$conditions .= 'AND type = :type ';
$params[':type'] = $_POST['armour_type'];
}
$data['result'] = Armours::model()->findAll($conditions, $params);
break;
case Inventory::EQUIPMENT_TYPE_SPEAR:
if (isset($_POST['spear_name']) && $_POST['spear_name'] != '') {
$data['defaultValues']['spear_name'] = $_POST['spear_name'];
$conditions .= 'AND name like :spear_name';
$params[':spear_name'] = '%' . $_POST['spear_name'] . '%';
}
if (isset($_POST['spear_material']) && is_numeric($_POST['spear_material'])) {
$data['defaultValues']['spear_material'] = $_POST['spear_material'];
$conditions .= 'AND spears_materials_id = :spear_material';
$params[':spear_material'] = $_POST['spear_material'];
}
if (isset($_POST['spear_equipment_size']) && is_numeric($_POST['spear_equipment_size'])) {
$data['defaultValues']['spear_equipment_size'] = $_POST['spear_equipment_size'];
$conditions .= 'AND equipment_size_id = :equipment_size_id';
$params[':equipment_size_id'] = $_POST['spear_equipment_size'];
}
if (isset($_POST['spear_equipment_quality']) && is_numeric($_POST['spear_equipment_quality'])) {
$data['defaultValues']['spear_equipment_quality'] = $_POST['spear_equipment_quality'];
$conditions .= 'AND equipment_qualities_id = :equipment_qualities_id';
$params[':equipment_qualities_id'] = $_POST['spear_equipment_quality'];
}
if (isset($_POST['spear_equipment_rarity']) && is_numeric($_POST['spear_equipment_rarity'])) {
$data['defaultValues']['spear_equipment_rarity'] = $_POST['spear_equipment_rarity'];
$conditions .= 'AND equipment_rarity_id = :equipment_rarity_id';
//.........这里部分代码省略.........
示例7: array
<?php
/* @var $this SiteController */
/* @var $model LoginForm */
/* @var $form CActiveForm */
$this->pageTitle=Yii::app()->name . ' - set';
$this->breadcrumbs=array(
'Login',
);
?>
<hr>
<?php echo "Author: ".Constants::model()->getCvalue('dayup'); ?>
<hr>
<h1>set</h1>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="row">
<?php echo CHtml::textField('constant'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('set'); ?>
示例8: getTypeText
/**
* Return the text of type
*/
public function getTypeText()
{
$model = Constants::model()->findByPk($this->type);
return $model->name;
}
示例9: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Inv('search');
$model->unsetAttributes();
// clear any default values
if (empty($_POST)) {
$model->from_date = Constants::model()->getCvalue('invf_' . Yii::app()->user->uid);
$model->to_date = Constants::model()->getCvalue('invt_' . Yii::app()->user->uid);
} else {
Constants::model()->setCvalue('invf_' . Yii::app()->user->uid, $_POST['Inv']['from_date']);
Constants::model()->setCvalue('invt_' . Yii::app()->user->uid, $_POST['Inv']['to_date']);
$model->from_date = $_POST['Inv']['from_date'];
$model->to_date = $_POST['Inv']['to_date'];
}
if (isset($_GET['Inv'])) {
$model->attributes = $_GET['Inv'];
}
$this->render('admin', array('model' => $model));
}
示例10: checkAccomplish
/**
* 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] Fuck yeah');
return true;
}
示例11: actionReport
public function actionReport()
{
// $model=Exp::model()->with(array('city','concert','expence'))->findByPk($id);
$model = new Exp('search');
$show = false;
$model->unsetAttributes();
// clear any default values
$model->arr_cur = Currency::model()->findAll();
if (empty($_POST)) {
$model->from_date = Constants::model()->getCvalue('repf_' . Yii::app()->user->uid);
$model->to_date = Constants::model()->getCvalue('rept_' . Yii::app()->user->uid);
} else {
$show = true;
Constants::model()->setCvalue('repf_' . Yii::app()->user->uid, $_POST['Exp']['from_date']);
Constants::model()->setCvalue('rept_' . Yii::app()->user->uid, $_POST['Exp']['to_date']);
if (isset($_POST['Exp'])) {
foreach ($_POST['Exp'] as $key => $row) {
switch ($key) {
case 'from_date':
$model->from_date = $row;
break;
case 'to_date':
$model->to_date = $row;
break;
case 'state_pay':
$model->state_pay = $row;
break;
case 'state_cur':
$model->state_cur = $row;
break;
case 'report_type':
$model->report_type = $row;
break;
}
}
}
}
$this->render('report', array('model' => $model, 'show' => $show));
}
示例12:
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name . ' - About';
$this->breadcrumbs=array(
'About',
);
?>
<h1>About</h1>
<?php
if(Yii::app()->user->hasState("title"))
echo "User Title:".Yii::app()->user->title."<br>";
if(Yii::app()->user->hasState("perm"))
echo "User Permission:".Yii::app()->user->perm."<br>";
if(Yii::app()->user->hasState("uid"))
echo "User ID:".Yii::app()->user->uid."<br>";
echo "Author: ".Constants::model()->getCvalue('author');
?>
示例13: actionSetCombatPoints
/**
* Set combats points
*/
public function actionSetCombatPoints()
{
Yii::trace('[CHARACTER][actionSetCombatPoints] Start');
$output = array('errno' => 1, 'html' => '', 'isFinishedRound' => false, 'isCombatFinished' => false, 'round_id' => null);
//Check session is enable
if (!Yii::app()->user->isGuest) {
//Check if user is in his page
if (Yii::app()->user->knights_id == $this->knight->id) {
//Check if input is valid
if (isset($_GET['combat']) && is_numeric($_GET['combat']) && $_GET['combat'] > 0 && isset($_GET['attack_position']) && is_numeric($_GET['attack_position']) && $_GET['attack_position'] > 0 && isset($_GET['defense_position']) && is_numeric($_GET['defense_position']) && $_GET['defense_position'] > 0) {
//Check if combat exist
$combat = Combats::model()->with('rounds')->findByPk($_GET['combat']);
if ($combat) {
//Check status of combat
if ($combat->status == Combats::STATUS_ENABLE) {
//Check if user is in combat
if (Yii::app()->user->knights_id == $combat->from_knight || Yii::app()->user->knights_id == $combat->to_knight) {
//Check if last round is pending
$output['round_id'] = count($combat->rounds);
if ($combat->rounds[$output['round_id'] - 1]->status == Rounds::STATUS_PENDING) {
//Check if user has data for this round
$roundData = RoundsData::model()->find('rounds_combats_id=:rounds_combats_id AND rounds_number=:rounds_number AND knights_id=:knights_id', array(':rounds_combats_id' => $combat->id, ':rounds_number' => $combat->rounds[count($combat->rounds) - 1]->number, ':knights_id' => Yii::app()->user->knights_id));
if (!$roundData) {
//Check if rival set attack and defense
if ($combat->from_knight == Yii::app()->user->knights_id) {
$rival_id = $combat->to_knight;
} else {
$rival_id = $combat->from_knight;
}
$roundDataRival = RoundsData::model()->find('rounds_combats_id=:rounds_combats_id AND rounds_number=:rounds_number AND knights_id=:knights_id', array(':rounds_combats_id' => $combat->id, ':rounds_number' => $combat->rounds[count($combat->rounds) - 1]->number, ':knights_id' => $rival_id));
//Load knight card
$knights_card = $this->knight->knightsCard;
/*
* LOAD EQUIPMENT IN USE (spear, shield and armour) for this knight user
*/
if ($roundDataRival) {
//Load spear, shield and armour. We have armour position of impact
$from_knight_received_impact_inventory_position = Inventory::getPositionFromAttackPosition($roundDataRival->attack_point);
Yii::trace('[CHARACTER][actionSetCombatPoints] Load equipment in use with attack position (' . $roundDataRival->attack_point . ') and position in inventory (' . $from_knight_received_impact_inventory_position . ')');
$user_knight_equipment = Inventory::getCurrentEquipment4Round(Yii::app()->user->knights_id, $from_knight_received_impact_inventory_position);
} else {
//Load only spear and shield.
$from_knight_received_impact_inventory_position = null;
Yii::trace('[CHARACTER][actionSetCombatPoints] Load equipment in use without attack position.');
$user_knight_equipment = Inventory::getCurrentEquipment4Round(Yii::app()->user->knights_id);
}
//Check if user has all equipment
if ($user_knight_equipment['spear_object'] != null && $user_knight_equipment['shield_object'] != null && (!$roundDataRival || $roundDataRival && $user_knight_equipment['armour_object'] != null)) {
//Insert round data for user
srand();
$roundData = new RoundsData();
$roundData->attributes = array('rounds_combats_id' => $combat->id, 'rounds_number' => count($combat->rounds), 'knights_id' => Yii::app()->user->knights_id, 'date' => date('Y-m-d H:i:s'), 'knights_endurance' => $this->knight->endurance, 'knights_life' => $this->knight->life, 'knights_pain' => $this->knight->pain, 'attack_point' => $_GET['attack_position'], 'defense_point' => $_GET['defense_position'], 'pain_throw' => $this->knight->pain ? rand(1, 10) : null, 'knights_will' => $knights_card->will, 'knights_concentration' => $knights_card->concentration, 'knights_skill' => $knights_card->skill, 'knights_dexterity' => $knights_card->dexterity, 'knights_spear' => $knights_card->spear, 'knights_shield' => $knights_card->shield, 'knights_constitution' => $knights_card->constitution, 'armour_id' => $user_knight_equipment['armour'] != null ? $user_knight_equipment['armour']->id : null, 'armour_object_pde_initial' => $user_knight_equipment['armour_object'] != null ? $user_knight_equipment['armour_object']->current_pde : null, 'shield_id' => $user_knight_equipment['shield']->id, 'shield_object_pde_initial' => $user_knight_equipment['shield_object']->current_pde, 'spears_id' => $user_knight_equipment['spear']->id, 'spears_object_pde_initial' => $user_knight_equipment['spear_object']->current_pde, 'attack_throw' => rand(1, 10), 'defense_throw' => rand(1, 10));
/*
* STATS ATTACK AND DEFENSE POINTS
*/
$sql = "UPDATE knights_stats_attack_location\n\t\t\t\t\t\t\t\t\t\t\t\t\tSET amount = amount +1\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE knights_id = :knights_id1 AND location = :location1;";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(':knights_id1', Yii::app()->user->knights_id);
$command->bindValue(':location1', $_GET['attack_position']);
if ($command->execute() == 0) {
Yii::trace('[CHARACTER][actionSetCombatPoints] No se ha podido actualizar las estadisticas de el punto de ataque', 'error');
}
$command->text = "INSERT INTO knights_stats_defense_location (knights_id, location, armours_type, amount)\n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ( :knights_id2, :location2, :armours_type2, 1)\n\t\t\t\t\t\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE amount = amount + 1;";
$command->bindValue(':knights_id2', Yii::app()->user->knights_id);
$command->bindValue(':location2', $_GET['defense_position']);
$command->bindValue(':armours_type2', $user_knight_equipment['shield']->type);
if ($command->execute() == 0) {
Yii::trace('[CHARACTER][actionSetCombatPoints] No se ha podido actualizar las estadisticas de el punto de defensa', 'error');
}
/*
$knight_statsAttackLocation = KnightsStatsAttackLocation::model()->find( 'knights_id = :knights_id AND location = :location', array(':knights_id'=>Yii::app()->user->knights_id, ':location'=>$_GET['attack_position'] ) );
$knight_statsAttackLocation->amount += 1;
if( !$knight_statsAttackLocation->save() ) Yii::trace( '[CHARACTER][actionSetCombatPoints] Las estadisticas de locaclizacion de punto de ataque no se ha podido salvar', 'error' );
unset( $knight_statsAttackLocation );
$knight_statsDefenseLocation = KnightsStatsDefenseLocation::model()->find( 'knights_id = :knights_id AND location = :location', array(':knights_id'=>Yii::app()->user->knights_id, ':location'=>$_GET['attack_position'] ) );
if( ! $knight_statsDefenseLocation ){
$knight_statsDefenseLocation = new KnightsStatsDefenseLocation();
$knight_statsDefenseLocation = 0;
$knight_statsDefenseLocation->armours_type = $user_knight_equipment['shield']->type;
}
$knight_statsDefenseLocation->amount += 1;
if( !$knight_statsDefenseLocation->save() ) Yii::trace( '[CHARACTER][actionSetCombatPoints] Las estadisticas de locaclizacion de punto de defensa no se ha podido salvar', 'error' );
unset( $knight_statsDefenseLocation );
*/
//Resolve combat if all data is insert
if ($roundDataRival) {
Yii::trace('[CHARACTER][actionSetCombatPoints] RESOLVIENDO COMBATE');
$roundData->received_impact_inventory_position = $from_knight_received_impact_inventory_position;
//Load inventory attack position
$roundDataRival->received_impact_inventory_position = Inventory::getPositionFromAttackPosition($roundData->attack_point);
/*
* LOAD EQUIPMENT IN USE (spear, shield and armour) for this knight user
*/
$rival_knight_equipment = Inventory::getCurrentEquipment4Round($roundDataRival->knights_id, $roundDataRival->received_impact_inventory_position);
//Load de armour by the attack point of user
//$inventoryRival = Inventory::model()->find( 'knights_id=:knights_id AND position=:position', array( ':knights_id'=>$roundDataRival->knights_id,':position'=>$roundDataRival->received_impact_inventory_position ) );
//.........这里部分代码省略.........
示例14: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin($ret = 0)
{
$model = new Pay('search');
$model->unsetAttributes();
// clear any default values
if (empty($_POST)) {
$model->from_date = Constants::model()->getCvalue('payf_' . Yii::app()->user->uid);
$model->to_date = Constants::model()->getCvalue('payt_' . Yii::app()->user->uid);
$model->state_pay = Constants::model()->getCvalue('paya_' . Yii::app()->user->uid);
if ($ret == 1) {
$model->cliname = Constants::model()->getCvalue('payc_' . Yii::app()->user->uid);
}
} else {
Constants::model()->setCvalue('payf_' . Yii::app()->user->uid, $_POST['Pay']['from_date']);
Constants::model()->setCvalue('payt_' . Yii::app()->user->uid, $_POST['Pay']['to_date']);
Constants::model()->setCvalue('paya_' . Yii::app()->user->uid, $_POST['Pay']['state_pay']);
$model->from_date = $_POST['Pay']['from_date'];
$model->to_date = $_POST['Pay']['to_date'];
$model->state_pay = $_POST['Pay']['state_pay'];
}
if (isset($_GET['Pay'])) {
$model->attributes = $_GET['Pay'];
}
if (isset($model->cliname)) {
Constants::model()->setCvalue('payc_' . Yii::app()->user->uid, $model->cliname);
} else {
Constants::model()->delCvalue('payc_' . Yii::app()->user->uid);
}
$this->render('admin', array('model' => $model, 'tmp' => $_GET['Exp']));
}
示例15: array
//echo $form->textField($model,'attribute',array('size'=>10,'maxlength'=>10));
?>
<?php
echo CHtml::dropDownList('Requirements[attribute]', $model->attribute, CHtml::listData(Constants::model()->findAll('type=:type', array(':type' => Constants::KNIGHTS_ATTRIBUTES)), 'id', 'name'), array('prompt' => 'Select a attribute'));
?>
<?php
echo $form->error($model, 'attribute');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'skill');
?>
<?php
echo CHtml::dropDownList('Requirements[skill]', $model->skill, CHtml::listData(Constants::model()->findAll('type=:type', array(':type' => Constants::KNIGHTS_SKILLS)), 'id', 'name'), array('prompt' => 'Select skill'));
?>
<?php
echo $form->error($model, 'skill');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'value');
?>
<?php
echo $form->textField($model, 'value');
?>
<?php
echo $form->error($model, 'value');