MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mstep.class
Ir para a documentação deste ficheiro.
1<?php
30/*
31 * Class MStep
32 *
33 */
34class MStep extends MDiv
35{
36 const TYPE_PREVIOUS = 'previous';
37 const TYPE_CURRENT = 'current';
38 const TYPE_NEXT = 'next';
39
40 // CSS style classes
41 const CURRENT_ICON_STYLE = 'm-step-icon m-step-icon-current';
42 const NEXT_ICON_STYLE = 'm-step-icon m-step-icon-next';
43 const PREVIOUS_ICON_STYLE = 'm-step-icon m-step-icon-previous';
44 const LABEL_STYLE = 'm-step-label';
45 const CURRENT_LABEL_STYLE = 'm-step-label m-step-label-atual';
46 const CURRENT_STYLE = 'm-step-current';
47 const ENABLED_STYLE = 'm-step m-step-enabled';
48 const DISABLED_STYLE = 'm-step m-step-disabled';
49 const STATUS_LABEL_STYLE = 'm-step-status-label';
50 const BUTTON_STYLE = 'm-step-button';
51 const NUMBER_STYLE = 'm-step-num';
52 const HIDE_STYLE = 'm-step-hide';
53
54 private $completedStep;
55 private $stepType;
56 private $stepNumber;
57
58 public $goTo;
59
60 public function __construct($stepNumber, $stepName, $stepType = self::TYPE_CURRENT)
61 {
63
64 $_GET['step'] = $stepNumber;
65
66 $this->completedStep = false;
67 $this->stepType = $stepType;
68 $this->stepNumber = $stepNumber;
69
70 if ( $stepType == self::TYPE_CURRENT )
71 {
72 $stepLabel = new MDiv('stepLabel_' . $stepNumber, $stepName, self::CURRENT_LABEL_STYLE);
73 $stepImage = new MDiv('stepImage_' . $stepNumber, '', self::CURRENT_ICON_STYLE);
74 $stepDescription = new MDiv('stepDescription_' . $stepNumber, _M('Current step'), self::STATUS_LABEL_STYLE);
75 }
76 elseif ( $stepType == self::TYPE_NEXT )
77 {
78 $stepLabel = new MDiv('stepLabel_' . $stepNumber, $stepName, self::LABEL_STYLE);
79 $stepImage = new MDiv('stepImage_' . $stepNumber, '', self::NEXT_ICON_STYLE);
80 $stepDescription = new MDiv('stepDescription_' . $stepNumber, _M('Pending step'), self::STATUS_LABEL_STYLE);
81 }
82 elseif ( $stepType == self::TYPE_PREVIOUS )
83 {
84 $stepLabel = new MDiv('stepLabel_' . $stepNumber, $stepName, self::LABEL_STYLE);
85 $stepImage = new MDiv('stepImage_' . $stepNumber, '', self::PREVIOUS_ICON_STYLE);
86 $stepDescription = new MDiv('stepDescription_' . $stepNumber, _M('Finished step'), self::STATUS_LABEL_STYLE);
87 $this->completedStep = true;
88 }
89
90 $divLeft = new MDiv('divLeft_' . $stepNumber, $stepImage, self::BUTTON_STYLE);
91 $divRight = new MDiv('divRight_' . $stepNumber, $stepNumber, self::NUMBER_STYLE);
92 $div = new MDiv('divStepInner_' . $stepNumber, array( $divRight, $divLeft, $stepDescription ), 'divStepInner');
93
94 parent::__construct('divStep_' . $stepNumber, array( $div, $stepLabel ));
95 }
96
97 public function generate()
98 {
100 $disableds = (array) $MIOLO->getConf('temp.disable.steps');
101
102 if ( $this->completedStep && !in_array($this->stepNumber, $disableds) )
103 {
104 $this->setBoxClass(self::ENABLED_STYLE);
105
106 $args = $MIOLO->getContext()->getVars();
107 unset($args['module']);
108 unset($args['action']);
109 $args['step'] = $this->stepNumber;
110
111 if (!$this->goTo )
112 {
113 $onclick = "GotoURL('".$MIOLO->getActionURL(MIOLO::getCurrentModule(), MIOLO::getCurrentAction(), NULL, $args)."');";
114 }
115 else
116 {
117 $onclick = $this->goTo;
118 }
119 $this->setBoxAttributes(array( 'onclick' => $onclick ));
120 }
121 else
122 {
123 $this->setBoxClass(self::DISABLED_STYLE);
124 }
125
126 if ( $this->stepType == self::TYPE_CURRENT )
127 {
128 $this->setBoxClass(self::CURRENT_STYLE);
129 }
130
131 return parent::generate();
132 }
133}
134?>
setBoxAttributes($attr)
Definição mcontrol.class:809
setBoxClass( $cssClass, $add=true)
Definição mcontrol.class:797
static getCurrentModule()
Definição miolo.class:1066
static getCurrentAction()
Definição miolo.class:1086
static getInstance()
Definição miolo.class:134
const CURRENT_STYLE
Definição mstep.class:46
const TYPE_NEXT
Definição mstep.class:38
const ENABLED_STYLE
Definição mstep.class:47
$goTo
Definição mstep.class:58
const DISABLED_STYLE
Definição mstep.class:48
const CURRENT_LABEL_STYLE
Definição mstep.class:45
const PREVIOUS_ICON_STYLE
Definição mstep.class:43
__construct($stepNumber, $stepName, $stepType=self::TYPE_CURRENT)
Definição mstep.class:60
const TYPE_CURRENT
Definição mstep.class:37
const NEXT_ICON_STYLE
Definição mstep.class:42
generate()
Definição mstep.class:97
const TYPE_PREVIOUS
Definição mstep.class:36
const NUMBER_STYLE
Definição mstep.class:51
const BUTTON_STYLE
Definição mstep.class:50
const STATUS_LABEL_STYLE
Definição mstep.class:49
const HIDE_STYLE
Definição mstep.class:52
const CURRENT_ICON_STYLE
Definição mstep.class:41
const LABEL_STYLE
Definição mstep.class:44