Example #1
0
 /**
  * @param $entity
  * @param $options
  * @param $names
  * @return bool
  */
 private function showConfig($entity)
 {
     $pm = new pageMagic('');
     $settingsHtml = '';
     if ($this->getWhatTypeAreWe() == 'form') {
         //General settings
         $diyform = configMagic::newdiyform('General Settings');
         $diyform->addText('FormName', 128, $this->options['FM_NAME']);
         $diyform->addText('Description', 512, $this->options['FM_DESC']);
         $diyform->addBoolean('AutoTranslate', $this->options['FM_AUTOTRANSLATE']);
         $diyform->addBoolean('HideBack', $this->options['FM_OPTIONS']['hideback']);
         $diyform->addBoolean('SlimForm', $this->options['FM_SLIMFORM']);
         $diyform->addText('SendText', 128, $this->options['FM_SENDTEXT']);
         $form = configMagic::convertDiyForm($diyform, false, 'diyFormSettingsView', 'diyFormSettingsName');
         if ($form->saved()) {
             $this->options['FM_NAME'] = $diyform->getValue('FormName');
             $this->options['FM_DESC'] = $diyform->getValue('Description');
             $this->options['FM_AUTOTRANSLATE'] = $diyform->getValue('AutoTranslate');
             $this->options['FM_SLIMFORM'] = $diyform->getValue('SlimForm');
             $this->options['FM_SENDTEXT'] = $diyform->getValue('SendText');
             $this->options['FM_OPTIONS']['hideback'] = $diyform->getValue('HideBack');
             $this->diskWriteOptions($this->options);
             return true;
         }
         $settingsHtml .= $pm->getPanel($form->getHtml(), 'General');
     }
     if ($this->getWhatTypeAreWe() == 'list') {
         if (count($entity)) {
             foreach ($entity as $first_ob) {
                 break;
             }
         } else {
             throw new \Exception("Error: DDF33332");
         }
         $entitymap = $first_ob::TABLE_MAP;
         $entitymap = $entitymap::getTableMap();
         $entityVirtualCols = $first_ob->getVirtualColumns();
     } elseif ($this->getWhatTypeAreWe() == 'form') {
         $entityVirtualCols = array();
         if (method_exists($entity, 'toArray')) {
             //we are coming from a Propel Object
             $map = $entity::TABLE_MAP;
             $entitymap = $map::getTableMap();
             $entityVirtualCols = $entity->getVirtualColumns();
             $this->FromPropel = true;
         } else {
             //We are being build manually
             $this->FromPropel = false;
             $entitymap = $entity;
         }
     }
     $loopHtmlBuilder = '';
     foreach ($entitymap->getColumns() as $colum) {
         if ($hest = $this->proccessColum($colum->getName(), $pm)) {
             $loopHtmlBuilder .= $hest;
         } else {
             return true;
         }
     }
     foreach ($entityVirtualCols as $key => $value) {
         if ($hest = $this->proccessColum($key, $pm)) {
             $loopHtmlBuilder .= $hest;
         } else {
             return true;
         }
     }
     $loopHtml = $pm->getPanel($loopHtmlBuilder, 'Fields');
     if ($this->getWhatTypeAreWe() == 'form') {
         $fm = new formMagic($entity, $this->getFormOptions(), $this->names);
         $demoHtml = $pm->getPanel($fm->html, 'Form');
     } elseif ($this->getWhatTypeAreWe() == 'list') {
         $lm = new listMagic($entity, $this->getListOptions(), $this->names);
         $demoHtml = $pm->getPanel($lm->getHTML(), 'List');
     }
     $pm->addRow($pm->getCol($demoHtml, 6) . $pm->getCol($settingsHtml, 3) . $pm->getCol($loopHtml, 3));
     $pm->finalize();
     return false;
 }
Example #2
0
 private function doLogin()
 {
     $diyform = configMagic::newdiyform('Login', $this->validationClosure);
     $diyform->addText('Login');
     $diyform->addText('PASSWORD');
     $form = configMagic::convertDiyForm($diyform, false, 'pm_login_FormView', 'pm_login_FormName');
     if ($form->saved()) {
         //Form was returned and server side validated
         $_SESSION['fingerprint'] = $this->sessionForUser();
         $_SESSION['intiated'] = time();
         $_SESSION['authenticatedId'] = $this->authenticatedId;
         return true;
     } else {
         //Form not returned, echo login HTML and return false
         $this->addHtml($form->getHtml());
         $this->finalize();
         return false;
     }
 }