本文整理汇总了PHP中Step::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Step::model方法的具体用法?PHP Step::model怎么用?PHP Step::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Step
的用法示例。
在下文中一共展示了Step::model方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionReorder
public function actionReorder($id)
{
$traveler = $this->loadModel($id);
if (isset($_POST['position'])) {
Step::model()->sortSteps($_POST['position']);
exit("ok");
}
$this->render('reorder', array('steps' => $traveler->getStepParent(), 'id' => $id));
}
示例2: loadStep
protected function loadStep($stepId)
{
//if the project property is null, create it based on input id
if ($this->step === null) {
$this->step = Step::model()->findbyPk($stepId);
if ($this->step === null) {
throw new CHttpException(404, 'The requested step does not exist.');
}
}
return $this->step;
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
throw new CHttpException(404, 'The requested page does not exist.');
$model = new File();
$issue = null;
if (isset($_GET['discrepancyId'])) {
$discrepancyId = $_GET['discrepancyId'];
$discrepancy = Nonconformity::model()->findByPk($discrepancyId);
$step = $discrepancy->step;
$model->discrepancyId = $discrepancyId;
$issue = Issue::model()->find("id = {$discrepancy->issueId}");
$dir = "discrepancy/";
} elseif (isset($_GET['stepId'])) {
$stepId = $_GET['stepId'];
$step = Step::model()->findByPk($stepId);
$model->stepId = $stepId;
$dir = "step/";
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['File'])) {
$model->attributes = $_POST['File'];
$upload = CUploadedFile::getInstance($model, 'fileSelected');
$rnd = rand(0, 99999);
if (@getimagesize($upload->tempName)) {
$model->image = 1;
} else {
$model->image = 0;
}
$fileName = "{$rnd}-{$upload}";
$model->userId = Yii::app()->user->id;
$model->fileSelected = $upload;
$link = $dir . preg_replace("/[^a-zA-Z0-9\\/_|.-]/", "_", $fileName);
if ($upload->saveAs(Yii::app()->params['dfs'] . "/{$link}")) {
$model->link = $link;
$model->save();
$this->redirect(array('index', 'discrepancyId' => $model->discrepancyId));
}
}
$this->render('create', array('model' => $model, 'step' => $step, 'issue' => $issue, 'discrepancyId' => $discrepancyId));
}
示例4: loadModel
/**
* 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 Step the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Step::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例5: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Element('search');
$model->unsetAttributes();
// clear any default values
if (!isset($_GET['stepId'])) {
throw new CHttpException(404, 'The requested page does not exist.');
}
$model->stepId = $_GET['stepId'];
if (isset($_GET['Element'])) {
$model->attributes = $_GET['Element'];
}
$this->render('admin', array('model' => $model, 'step' => Step::model()->findByPk($model->stepId)));
}
示例6: getStep
public function getStep($id)
{
return Step::model()->findByPk($id);
}
示例7: array
?>
<div class="row">
<?php
if (isset($parentId)) {
?>
<?php
echo $form->hiddenField($model, 'parentId', array('value' => $parentId));
?>
<?php
} else {
?>
<?php
echo $form->labelEx($model, 'parentId');
?>
<?php
echo $form->dropDownList($model, 'parentId', CHtml::listData(Step::model()->getStepParent($travelerId), 'id', 'stepName'), array('prompt' => Yii::t('default', 'None')));
?>
<?php
echo $form->error($model, 'parentId');
?>
<?php
}
?>
</div>
<?php
}
?>
<div class="row">
<?php
echo $form->labelEx($model, 'name');
?>
示例8: initSteps
public function initSteps(){
$step1 = Step::model()->findByPk(1);
$step2 = Step::model()->findByPk(2);
$step3 = Step::model()->findByPk(3);
$step4 = Step::model()->findByPk(4);
$step5 = Step::model()->findByPk(5);
$step1->stepTitle = Yii::t('step','0038');
$step2->stepTitle = Yii::t('step','0039');
$step3->stepTitle = Yii::t('step','0040');
$step4->stepTitle = Yii::t('step','0041');
$step5->stepTitle = Yii::t('step','0042');
$step1->stepText = Yii::t('step','0044');
$step2->stepText = Yii::t('step','0045');
$step3->stepText = Yii::t('step','0046');
$step4->stepText = Yii::t('step','0047');
$step5->stepText = Yii::t('step','0048');
return $arraySteps = array(
'step1'=>$step1,
'step2'=>$step2,
'step3'=>$step3,
'step4'=>$step4,
'step5'=>$step5,
);
}
示例9: getStepParent
public function getStepParent()
{
return Step::model()->getStepParent($this->id);
}
示例10: sortSteps
public function sortSteps($position)
{
$i = 1;
foreach ($position as $id) {
$step = Step::model()->findByPk($id);
$step->position = $i;
$step->save();
$i++;
}
}