This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models; | |
use Yii; | |
/** | |
* This is the model class for table "{{%sw_status}}". | |
* | |
* @property string $id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models\wizflow; | |
use Yii; | |
use yii\base\Model; | |
use raoul2000\workflow\validation\WorkflowScenario; | |
/** | |
* ContactForm is the model behind the contact form. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models\wizflow; | |
use raoul2000\workflow\source\file\IWorkflowDefinitionProvider; | |
class Wizflow implements IWorkflowDefinitionProvider | |
{ | |
public function getDefinition() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WizflowController extends \yii\web\Controller | |
{ | |
public function beforeAction($action) | |
{ | |
if (parent::beforeAction($action)) { | |
Yii::setAlias('@workflowDefinitionNamespace','app\\models\\wizflow'); | |
Yii::$app->set('workflowSource',[ | |
'class' => '\raoul2000\workflow\source\file\WorkflowFileSource' | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace app\components; | |
use Yii; | |
use raoul2000\workflow\base\Status; | |
use yii\base\Exception; | |
use yii\base\InvalidConfigException; | |
/** | |
* Implement the Wizard UI design pattern using yii2-workflow. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the model ///////////////////////////////////////////////////////////////////// | |
class Post extends \yii\db\ActiveRecord | |
{ | |
/** | |
* @inheritdoc | |
*/ | |
public static function tableName() | |
{ | |
return 'item'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dayNames = array( | |
0 => "Sunday", | |
1 => "Monday", | |
2 => "Tuesday", | |
3 => "Wednesday", | |
4 => "Thursday", | |
5 => "Friday", | |
6 => "Saturday" | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//This will get an array of all the gif, jpg and png images in a folder | |
$img_array = glob("/path/to/images/*.{gif,jpg,png}",GLOB_BRACE); | |
//Pick a random image from the array | |
$img = array_rand($img_array); | |
//Display the image on the page | |
echo '<img alt="'.$img_array[$img].'" src="'.$img_array[$img].'" />'; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User extends CActiveRecord | |
{ | |
public function behaviors() | |
{ | |
return array( | |
'swBehavior' => array( | |
'class' => 'application.extensions.simpleWorkflow.SWActiveRecordBehavior', | |