Exemple #1
0
 public function log()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.tools.log', true, '/tools');
     $delete = Converter::bool('delete');
     $code = Converter::int('code');
     $id = Converter::int('id', 'get');
     $deleteUrl = $code != 0 ? '?code=' . $code . '&delete=true' : '?delete=true';
     if ($delete) {
         Auth::isAdminAuthorized($this->signedUser, 'admin.tools.log.edit', true, '/tools');
         \Rebond\Core\Log\Data::clear($code);
         Session::adminSuccess('logClear', '/tools/log');
     }
     if ($id != 0) {
         $log = \Rebond\Core\Log\Data::loadById($id);
         if (isset($log)) {
             // view
             $this->setTpl();
             $formLog = new \Rebond\Core\Log\Form($log);
             // main
             $tplMain = new Template(Template::MODULE, ['core', 'log']);
             $tplMain->set('item', $formLog);
             // layout
             $this->tplLayout->set('column1', $tplMain->render('view'));
             // master
             $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
             return $this->tplMaster->render('tpl-default');
         }
     }
     $options = [];
     $options['order'][] = 'log.modified_date DESC';
     if ($code != 0) {
         $options['where'][] = ['log.code = ?', $code];
     }
     $options['limit'][] = 200;
     $logs = \Rebond\Core\Log\Data::loadAll($options);
     // view
     $this->setTpl();
     // filter
     $tplFilter = new Template(Template::MODULE, ['core', 'log']);
     $tplFilter->set('count', count($logs));
     $tplFilter->set('list', \Rebond\Util\Error::errorCodes());
     $tplFilter->set('code', $code);
     $tplFilter->set('deleteUrl', '/tools/log/' . $deleteUrl);
     // main
     $tplMain = new Template(Template::MODULE, ['core', 'log']);
     $tplMain->set('items', $logs);
     // layout
     $this->tplLayout->set('column1', $tplFilter->render('filter'));
     $this->tplLayout->set('column2', $tplMain->render('listing'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-2-row'));
     $this->tplMaster->set('jsLauncher', 'toolsLog');
     return $this->tplMaster->render('tpl-default');
 }
Exemple #2
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('summary', $properties)) {
         $value = Util\Converter::string('summary' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSummary($value);
         }
     }
     if (!isset($properties) || in_array('workflow', $properties)) {
         $value = Util\Converter::int('workflow' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setWorkflow($value);
         }
     }
     if (!isset($properties) || in_array('hasFilter', $properties)) {
         $value = Util\Converter::bool('hasFilter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHasFilter($value);
         }
     }
     if (!isset($properties) || in_array('hasContent', $properties)) {
         $value = Util\Converter::bool('hasContent' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHasContent($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #3
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('parentId', $properties)) {
         $value = Util\Converter::int('parentId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setParentId($value);
         }
     }
     if (!isset($properties) || in_array('templateId', $properties)) {
         $value = Util\Converter::int('templateId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTemplateId($value);
         }
     }
     if (!isset($properties) || in_array('layoutId', $properties)) {
         $value = Util\Converter::int('layoutId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setLayoutId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('css', $properties)) {
         $value = Util\Converter::string('css' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCss($value);
         }
     }
     if (!isset($properties) || in_array('js', $properties)) {
         $value = Util\Converter::string('js' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setJs($value);
         }
     }
     if (!isset($properties) || in_array('inNavHeader', $properties)) {
         $value = Util\Converter::bool('inNavHeader' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavHeader($value);
         }
     }
     if (!isset($properties) || in_array('inNavSide', $properties)) {
         $value = Util\Converter::bool('inNavSide' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavSide($value);
         }
     }
     if (!isset($properties) || in_array('inSitemap', $properties)) {
         $value = Util\Converter::bool('inSitemap' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInSitemap($value);
         }
     }
     if (!isset($properties) || in_array('inBreadcrumb', $properties)) {
         $value = Util\Converter::bool('inBreadcrumb' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInBreadcrumb($value);
         }
     }
     if (!isset($properties) || in_array('inNavFooter', $properties)) {
         $value = Util\Converter::bool('inNavFooter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavFooter($value);
         }
     }
     if (!isset($properties) || in_array('friendlyUrlPath', $properties)) {
         $value = Util\Converter::string('friendlyUrlPath' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFriendlyUrlPath($value);
         }
     }
     if (!isset($properties) || in_array('friendlyUrl', $properties)) {
         $value = Util\Converter::string('friendlyUrl' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFriendlyUrl($value);
         }
     }
     if (!isset($properties) || in_array('redirect', $properties)) {
         $value = Util\Converter::string('redirect' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setRedirect($value);
         }
     }
     if (!isset($properties) || in_array('class', $properties)) {
         $value = Util\Converter::string('class' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setClass($value);
         }
     }
     if (!isset($properties) || in_array('permission', $properties)) {
         $value = Util\Converter::string('permission' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPermission($value);
         }
     }
     if (!isset($properties) || in_array('displayOrder', $properties)) {
         $value = Util\Converter::int('displayOrder' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDisplayOrder($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #4
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('folderId', $properties)) {
         $value = Util\Converter::int('folderId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFolderId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('tags', $properties)) {
         $value = Util\Converter::string('tags' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTags($value);
         }
     }
     if (!isset($properties) || in_array('upload', $properties)) {
         $value = Util\Converter::string('upload' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUpload($value);
         }
     }
     if (!isset($properties) || in_array('originalFilename', $properties)) {
         $value = Util\Converter::string('originalFilename' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setOriginalFilename($value);
         }
     }
     if (!isset($properties) || in_array('path', $properties)) {
         $value = Util\Converter::string('path' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPath($value);
         }
     }
     if (!isset($properties) || in_array('extension', $properties)) {
         $value = Util\Converter::string('extension' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setExtension($value);
         }
     }
     if (!isset($properties) || in_array('mimeType', $properties)) {
         $value = Util\Converter::string('mimeType' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMimeType($value);
         }
     }
     if (!isset($properties) || in_array('fileSize', $properties)) {
         $value = Util\Converter::int('fileSize' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFileSize($value);
         }
     }
     if (!isset($properties) || in_array('width', $properties)) {
         $value = Util\Converter::int('width' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setWidth($value);
         }
     }
     if (!isset($properties) || in_array('height', $properties)) {
         $value = Util\Converter::int('height' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHeight($value);
         }
     }
     if (!isset($properties) || in_array('alt', $properties)) {
         $value = Util\Converter::string('alt' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAlt($value);
         }
     }
     if (!isset($properties) || in_array('isSelectable', $properties)) {
         $value = Util\Converter::bool('isSelectable' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsSelectable($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #5
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('googleAnalytics', $properties)) {
         $value = Util\Converter::string('googleAnalytics' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setGoogleAnalytics($value);
         }
     }
     if (!isset($properties) || in_array('keywords', $properties)) {
         $value = Util\Converter::string('keywords' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setKeywords($value);
         }
     }
     if (!isset($properties) || in_array('description', $properties)) {
         $value = Util\Converter::string('description' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDescription($value);
         }
     }
     if (!isset($properties) || in_array('css', $properties)) {
         $value = Util\Converter::string('css' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCss($value);
         }
     }
     if (!isset($properties) || in_array('js', $properties)) {
         $value = Util\Converter::string('js' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setJs($value);
         }
     }
     if (!isset($properties) || in_array('signInUrl', $properties)) {
         $value = Util\Converter::string('signInUrl' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSignInUrl($value);
         }
     }
     if (!isset($properties) || in_array('environment', $properties)) {
         $value = Util\Converter::int('environment' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setEnvironment($value);
         }
     }
     if (!isset($properties) || in_array('sqlLog', $properties)) {
         $value = Util\Converter::bool('sqlLog' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSqlLog($value);
         }
     }
     if (!isset($properties) || in_array('timezone', $properties)) {
         $value = Util\Converter::string('timezone' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTimezone($value);
         }
     }
     if (!isset($properties) || in_array('isCms', $properties)) {
         $value = Util\Converter::bool('isCms' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsCms($value);
         }
     }
     if (!isset($properties) || in_array('cacheTime', $properties)) {
         $value = Util\Converter::int('cacheTime' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCacheTime($value);
         }
     }
     if (!isset($properties) || in_array('useDeviceTemplate', $properties)) {
         $value = Util\Converter::bool('useDeviceTemplate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUseDeviceTemplate($value);
         }
     }
     if (!isset($properties) || in_array('skin', $properties)) {
         $value = Util\Converter::string('skin' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSkin($value);
         }
     }
     if (!isset($properties) || in_array('sendMailOnError', $properties)) {
         $value = Util\Converter::bool('sendMailOnError' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSendMailOnError($value);
         }
     }
     if (!isset($properties) || in_array('mailListOnError', $properties)) {
         $value = Util\Converter::string('mailListOnError' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMailListOnError($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #6
0
 public function generated_photos()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.media.image', true, '/media');
     $photos = \Rebond\Util\File::getFiles('www/media');
     $generated = [];
     $pattern = '/-(.*).(.*)/';
     $count = count($photos);
     for ($i = 0; $i < $count; $i++) {
         if (preg_match($pattern, $photos[$i])) {
             $generated[] = $photos[$i];
             unset($photos[$i]);
         }
     }
     $cleanup = Converter::bool('cleanup');
     if ($cleanup) {
         foreach ($generated as $photo) {
             \Rebond\Util\File::deleteAllMedia('', $photo);
         }
         Session::adminSuccess('generatedPhotosDeleted', '/media/generated-photos');
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Template(Template::SITE, ['admin', 'media']);
     $tplMain->set('photos', $photos);
     $tplMain->set('generated', $generated);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('generated-photos'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     return $this->tplMaster->render('tpl-default');
 }
Exemple #7
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('summary', $properties)) {
         $value = Util\Converter::string('summary' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSummary($value);
         }
     }
     if (!isset($properties) || in_array('filename', $properties)) {
         $value = Util\Converter::string('filename' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFilename($value);
         }
     }
     if (!isset($properties) || in_array('menu', $properties)) {
         $value = Util\Converter::int('menu' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMenu($value);
         }
     }
     if (!isset($properties) || in_array('menuLevel', $properties)) {
         $value = Util\Converter::int('menuLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMenuLevel($value);
         }
     }
     if (!isset($properties) || in_array('inBreadcrumb', $properties)) {
         $value = Util\Converter::bool('inBreadcrumb' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInBreadcrumb($value);
         }
     }
     if (!isset($properties) || in_array('sideNav', $properties)) {
         $value = Util\Converter::int('sideNav' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSideNav($value);
         }
     }
     if (!isset($properties) || in_array('sideNavLevel', $properties)) {
         $value = Util\Converter::int('sideNavLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSideNavLevel($value);
         }
     }
     if (!isset($properties) || in_array('inFooter', $properties)) {
         $value = Util\Converter::bool('inFooter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInFooter($value);
         }
     }
     if (!isset($properties) || in_array('footerLevel', $properties)) {
         $value = Util\Converter::int('footerLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFooterLevel($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #8
0
 public function bin()
 {
     // auth
     Util\Auth::isAdminAuthorized($this->signedUser, 'admin.dev', true, '/');
     // check
     $result = '';
     $empty = Util\Converter::bool('empty');
     $contentItems = [];
     // content items
     $options = [];
     $options['where'][] = 'module.has_content = 1';
     $modules = \Rebond\Cms\Module\Data::loadAll($options);
     $options = [];
     $options['where'][] = ['content.version IN (?)', [4, 5]];
     $options['order'][] = 'content.modified_date';
     foreach ($modules as $module) {
         $appData = '\\Rebond\\App\\' . $module->getTitle() . '\\Data';
         $items = $appData::loadAll($options);
         if (count($items) > 0) {
             if ($empty) {
                 foreach ($items as $item) {
                     $item->delete();
                 }
             } else {
                 $contentItems[$module->getTitle()] = $items;
             }
         }
     }
     // CSS
     $filePath = \Rebond\Config::getPath('siteFolder') . '/css/skin/';
     $skins = Util\File::getFolders($filePath);
     $cssFiles = [];
     foreach ($skins as $skin) {
         $cssFiles[$skin] = [];
         $path = $filePath . $skin . '/';
         $files = Util\File::getFiles($path);
         foreach ($files as $file) {
             if (Util\File::getExtension($file) == 'css') {
                 continue;
             }
             if ($empty) {
                 Util\File::delete($path, $file);
             } else {
                 $date = Util\Format::date(filemtime(FULL_PATH . $path . $file), 'smart');
                 $cssFiles[$skin][] = ['name' => $file, 'date' => $date];
             }
         }
     }
     // Main Templates
     $path = 'views/' . \Rebond\Config::getPath('siteFolder') . '/';
     $templates = Util\File::getFiles($path);
     $mainTpl = [];
     foreach ($templates as $tpl) {
         if (Util\File::getExtension($tpl) == 'tpl') {
             continue;
         }
         if ($empty) {
             Util\File::delete($path, $tpl);
         } else {
             $date = Util\Format::date(filemtime(FULL_PATH . $path . $tpl), 'smart');
             $mainTpl[] = ['name' => $tpl, 'date' => $date];
         }
     }
     // App Templates
     $appFolders = Util\File::getFolders('Rebond/App/');
     $appTpl = [];
     foreach ($appFolders as $app) {
         $appTpl[$app] = [];
         $path = 'Rebond/App/' . $app . '/template/';
         $templates = Util\File::getFiles($path);
         foreach ($templates as $tpl) {
             if (Util\File::getExtension($tpl) == 'tpl') {
                 continue;
             }
             if ($empty) {
                 Util\File::delete($path, $tpl);
             } else {
                 $date = Util\Format::date(filemtime(FULL_PATH . $path . $tpl), 'smart');
                 $appTpl[$app][] = ['name' => $tpl, 'date' => $date];
             }
         }
     }
     if ($empty) {
         $result = '<p class="bg-success">' . Util\Lang::lang('binEmptied') . '</p>';
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Util\Template(Util\Template::SITE, ['admin', 'dev']);
     $tplMain->set('contentItems', $contentItems);
     $tplMain->set('cssFiles', $cssFiles);
     $tplMain->set('mainTpl', $mainTpl);
     $tplMain->set('appTpl', $appTpl);
     $tplMain->set('result', $result);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('bin'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     $this->tplMaster->set('jsLauncher', 'dev');
     return $this->tplMaster->render('tpl-default');
 }
Exemple #9
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('moduleId', $properties)) {
         $value = Util\Converter::int('moduleId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setModuleId($value);
         }
     }
     if (!isset($properties) || in_array('appId', $properties)) {
         $value = Util\Converter::int('appId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAppId($value);
         }
     }
     if (!isset($properties) || in_array('contentGroup', $properties)) {
         $value = Util\Converter::int('contentGroup' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setContentGroup($value);
         }
     }
     if (!isset($properties) || in_array('filterId', $properties)) {
         $value = Util\Converter::int('filterId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFilterId($value);
         }
     }
     if (!isset($properties) || in_array('authorId', $properties)) {
         $value = Util\Converter::int('authorId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAuthorId($value);
         }
     }
     if (!isset($properties) || in_array('publisherId', $properties)) {
         $value = Util\Converter::int('publisherId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPublisherId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('urlFriendlyTitle', $properties)) {
         $value = Util\Converter::string('urlFriendlyTitle' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUrlFriendlyTitle($value);
         }
     }
     if (!isset($properties) || in_array('useExpiration', $properties)) {
         $value = Util\Converter::bool('useExpiration' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUseExpiration($value);
         }
     }
     if (!isset($properties) || in_array('goLiveDate', $properties)) {
         $value = Util\Converter::datetime('goLiveDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setGoLiveDate($value);
         }
     }
     if (!isset($properties) || in_array('expiryDate', $properties)) {
         $value = Util\Converter::datetime('expiryDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setExpiryDate($value);
         }
     }
     if (!isset($properties) || in_array('publishedDate', $properties)) {
         $value = Util\Converter::datetime('publishedDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPublishedDate($value);
         }
     }
     if (!isset($properties) || in_array('version', $properties)) {
         $value = Util\Converter::int('version' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setVersion($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Exemple #10
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('username', $properties)) {
         $value = Util\Converter::string('username' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUsername($value);
         }
     }
     if (!isset($properties) || in_array('email', $properties)) {
         $value = Util\Converter::string('email' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setEmail($value);
         }
     }
     if (!isset($properties) || in_array('password', $properties)) {
         $value = Util\Converter::string('password' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPassword($value);
         }
     }
     if (!isset($properties) || in_array('firstname', $properties)) {
         $value = Util\Converter::string('firstname' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFirstname($value);
         }
     }
     if (!isset($properties) || in_array('lastname', $properties)) {
         $value = Util\Converter::string('lastname' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setLastname($value);
         }
     }
     if (!isset($properties) || in_array('avatarId', $properties)) {
         $value = Util\Converter::int('avatarId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAvatarId($value);
         }
     }
     if (!isset($properties) || in_array('isAdmin', $properties)) {
         $value = Util\Converter::bool('isAdmin' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsAdmin($value);
         }
     }
     if (!isset($properties) || in_array('isDev', $properties)) {
         $value = Util\Converter::bool('isDev' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsDev($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }