class Toolkit_Videos_AdminEditVideoForm
extends Toolkit_FormBuilder
{
- /**
- * What do you want the success msg to be if the form validates successfully
- *
- * @var string
- * @access protected
- */
- protected $successMsg
- = '<div id="form-success-top">Coupon successfully updated.</div>';
+ /**
+ * What do you want the success msg to be if the form validates successfully
+ *
+ * @var string
+ * @access protected
+ */
+ protected $successMsg
+ = '<div id="form-success-top">Coupon successfully updated.</div>';
- /**
- * The default rules to register for validating
- *
- * We have to register these rules, or any others we want, before
- * we are able to use them in our forms.
- *
- * @var string
- * @access protected
- */
- protected $registeredRules = array(
- array(
- 'checkURI',
- 'callback',
- 'uri',
- 'Validate'
- )
- );
+ /**
+ * The default rules to register for validating
+ *
+ * We have to register these rules, or any others we want, before
+ * we are able to use them in our forms.
+ *
+ * @var string
+ * @access protected
+ */
+ protected $registeredRules = array(
+ array(
+ 'checkURI',
+ 'callback',
+ 'uri',
+ 'Validate'
+ )
+ );
public $errorMsg = '
<div id="form-warning-top">There was a Problem with your form!</div>';
* @return void
*/
public function configureElements(PDO $dbh, Config_Container $c)
- {
+ {
$e = array();
// get reference to [conf] section of config file
->getContent();
// All Elements are created here.
// This includes group element definitions.
- $e[] = array(
+ $e[] = array(
'type' => 'advcheckbox',
'req' => false,
'name' => 'active',
- 'display' => 'Active',
- 'val' => array(0, 1)
+ 'display' => 'Active',
+ 'val' => array(0, 1)
);
if ($appHasFeaturedVideos) {
$e[] = array(
);
}
$e[] = array(
- 'type' => 'text',
- 'req' => true,
- 'name' => 'video_url',
- 'display' => 'Video Link<br>
+ 'type' => 'text',
+ 'req' => true,
+ 'name' => 'video_url',
+ 'display' => 'Video Link<br>
<span style="color:blue">
Click on the \'Share\' function on the YouTube video
<br>to get your link. If you\'re having problems click on "show options"
and select "long link"</span>',
- 'opts' => array('class' => 'text','size'=>50)
+ 'opts' => array('class' => 'text','size'=>50)
);
- $e[] = array(
+ $e[] = array(
'type' => 'submit',
'req' => false,
'name' => 'submit_rmv',
);
}
- $this->setupElements($e);
- }
+ $this->setupElements($e);
+ }
/**
* Setup Form filters
* @return void
*/
public function configureFilters()
- {
+ {
$f = array();
- $f[] = array(
+ $f[] = array(
'element' => '__ALL__',
'filter' => 'trim'
);
$f[] = array(
'element' => 'url',
- 'filter' => array('Toolkit_Common', 'filterURI')
+ 'filter' => array('Toolkit_Common', 'filterURI')
);
- $this->setupFilters($f);
- }
+ $this->setupFilters($f);
+ }
/**
* Runs all function to setup the Form
* @return void
*/
public function configureForm(
- PDO $dbh,
- Config_Container $c
- ) {
- $this->configureElements($dbh, $c);
- $this->configureFilters();
- $this->configureRules();
- $this->configureDefaults($dbh);
- $this->configureConstants();
- }
+ PDO $dbh,
+ Config_Container $c
+ ) {
+ $this->configureElements($dbh, $c);
+ $this->configureFilters();
+ $this->configureRules();
+ $this->configureDefaults($dbh);
+ $this->configureConstants();
+ }
/**
* Setup the Form's rules
* @return void
*/
public function configureRules()
- {
+ {
$r = array();
- $r[] = array(
- 'element' => 'video_url',
- 'message' => 'ERROR: Invalid URL format (http)',
- 'type' => 'checkURI',
- 'format' => array(
- 'allowed_schemes' => array('http'),
- 'strict' => false
- ),
- 'validation' => $this->validationType,
- 'reset' => false,
- 'force' => false
- );
+ $r[] = array(
+ 'element' => 'video_url',
+ 'message' => 'ERROR: Invalid URL format (http)',
+ 'type' => 'checkURI',
+ 'format' => array(
+ 'allowed_schemes' => array('http'),
+ 'strict' => false
+ ),
+ 'validation' => $this->validationType,
+ 'reset' => false,
+ 'force' => false
+ );
- $this->setupRules($r);
- }
+ $this->setupRules($r);
+ }
/**
* _processData function creates an video object Toolkit_Videos_Video
}
}
- $this->setupRenderers();
- if ($this->validate()) {
- $this->cleanForm();
+ $this->setupRenderers();
+ if ($this->validate()) {
+ $this->cleanForm();
- $submitValues = $this->getSubmitValues();
- if ($this->_processData($dbh, $submitValues)) {
- $this->freeze();
- $output = $this->successMsg;
- }
+ $submitValues = $this->getSubmitValues();
+ if ($this->_processData($dbh, $submitValues)) {
+ $this->freeze();
+ $output = $this->successMsg;
+ }
header('Location: videos.php');
- } elseif ($this->isSubmitted()) {
- $output = $this->errorMsg;
- $output .= parent::toHTML();
- } else {
- $output = parent::toHTML();
- }
- return $output;
- }
+ } elseif ($this->isSubmitted()) {
+ $output = $this->errorMsg;
+ $output .= parent::toHTML();
+ } else {
+ $output = parent::toHTML();
+ }
+ return $output;
+ }
}