public function package()
 {
     Loader::model('file_set');
     $pl = new MootoolsPluginList();
     $package = $this->post("package");
     $fs = Fileset::getByName($package);
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $username = $ui->getAttribute(MOOTOOLS_GITHUB_USER);
     $pkgHandle = FRONTEND_DEVELOPER_PACKAGE_HANDLE;
     $uID = $u->getUserID();
     $files = $pl->getMootoolsPluginFiles($fs);
     $filesets[$fs->getFileSetName()] = $files;
     $package = Package::getByHandle($pkgHandle);
     $path = $package->getPackagePath();
     include $path . "/elements/plugin_files.php";
     exit;
 }
 public function init()
 {
     $this->translate = Zend_Registry::get('translate');
     //Zend_Form::setDefaultTranslator( Zend_Registry::get('translate') );
     // Set the method for the display form to POST
     $this->setMethod('post');
     $from_form = $this->addElement('hidden', 'from_form', array('decorators' => $this->elDecorators, 'value' => '1'));
     // load models
     Zend_Loader::loadClass('Client');
     Zend_Loader::loadClass('FileSet');
     Zend_Loader::loadClass('Storage');
     /*
      *  Job Name
      */
     $table_job = new Job();
     $jobs = $table_job->getListJobs();
     // select
     $jobname = $this->createElement('select', 'jobname', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Job Name'), 'required' => true, 'class' => 'ui-select', 'style' => 'width: 25em;'));
     foreach ($jobs as $v) {
         $jobname->addMultiOption($v, $v);
     }
     /*
      * Client
      */
     $table_client = new Client();
     //$order  = array('ClientId', 'Name');
     $order = array('Name');
     $clients = $table_client->fetchAll(null, $order);
     // select
     $client = $this->createElement('select', 'client', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Client'), 'required' => false, 'class' => 'ui-select', 'style' => 'width: 25em;'));
     $client->addMultiOption('', $this->translate->_("Default"));
     foreach ($clients as $v) {
         $client->addMultiOption($v['name'], $v['name']);
     }
     /*
      * Fileset
      */
     $table_filesets = new Fileset();
     $order = array('Fileset');
     $filesets = $table_filesets->fetchAll(null, $order);
     // select
     $fileset = $this->createElement('select', 'fileset', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Fileset'), 'required' => false, 'class' => 'ui-select', 'style' => 'width: 25em;'));
     $fileset->addMultiOption('', $this->translate->_("Default"));
     foreach ($filesets as $v) {
         $fileset->addMultiOption($v['fileset'], $v['fileset']);
     }
     /*
      * Storage
      */
     $table_storages = new Storage();
     $order = array('Name');
     $storages = $table_storages->fetchAll(null, $order);
     // select
     $storage = $this->createElement('select', 'storage', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Storage'), 'required' => false, 'class' => 'ui-select', 'style' => 'width: 25em;'));
     $storage->addMultiOption('', $this->translate->_("Default"));
     foreach ($storages as $v) {
         $storage->addMultiOption($v['name'], $v['name']);
     }
     /*
      * Level
      */
     // select
     $level = $this->createElement('select', 'level', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Level'), 'required' => false, 'class' => 'ui-select', 'style' => 'width: 20em;'));
     $level->addMultiOptions(array('' => $this->translate->_("Default"), "Full" => $this->translate->_("Full level"), "Incremental" => $this->translate->_("Incremental level"), "Differential" => $this->translate->_("Differential level")));
     /*
      * Spool
      */
     // select
     $spool = $this->createElement('select', 'spool', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Spool'), 'required' => false, 'class' => 'ui-select', 'style' => 'width: 15em;'));
     $spool->addMultiOptions(array('' => $this->translate->_("Default"), "yes" => $this->translate->_("Yes"), "no" => $this->translate->_("No")));
     /*
      * checkbox Now
      */
     $checkbox_now = $this->createElement('checkbox', 'checkbox_now', array('decorators' => $this->elDecorators, 'label' => 'Now', 'onclick' => 'whenNow(this)', 'checked' => 1));
     /*
      * When : date/time
      */
     // date
     $date_when = $this->createElement('text', 'date_when', array('decorators' => $this->elDecorators, 'label' => '', 'required' => false, 'size' => 10, 'maxlength' => 10, 'disabled' => 'true', 'value' => date('Y-m-d', time())));
     $date_when->addValidator('StringLength', false, array(1, 10));
     // time
     $time_when = $this->createElement('text', 'time_when', array('decorators' => $this->elDecorators, 'label' => '', 'required' => false, 'size' => 8, 'maxlength' => 8, 'disabled' => 'true', 'value' => date('H:i:s', time())));
     $time_when->addValidator('StringLength', false, array(1, 8));
     /*
      * submit button
      */
     $submit = new Zend_Form_Element_Submit('submit', array('decorators' => $this->elDecorators, 'id' => 'ok1', 'class' => 'prefer_btn', 'label' => $this->translate->_('Run Job')));
     /*
      *  add elements to form
      */
     $this->addElements(array($jobname, $client, $fileset, $storage, $level, $spool, $checkbox_now, $date_when, $time_when, $submit));
 }