public function buildSkin() { $skins = Util\File::getFolders(\Rebond\Config::getPath('siteFolder') . '/css/skin'); $list = []; foreach ($skins as $skin) { $list[$skin] = $skin; } return Util\Form::buildDropDown('skin' . $this->unique, $list, $this->getModel()->getSkin()); }
public function quickedit() { // auth Auth::isAdminAuthorized($this->signedUser, 'admin.tools', true, '/'); // check $module = Converter::string('module'); $id = Converter::int('id'); $id2 = Converter::int('id2'); $save = Converter::string('save', 'post'); if ($module == '') { header('Location: /tools/quickview'); exit; } $busModel = '\\Rebond\\Bus\\' . $module . '\\Model'; $busData = '\\Rebond\\Bus\\' . $module . '\\Data'; $busForm = '\\Rebond\\Bus\\' . $module . '\\Form'; if ($id == 0) { $entity = new $busModel(); } else { if ($id2 != 0) { $entity = $busData::loadById($id, $id2); } else { $entity = $busData::loadById($id); } if (!isset($entity)) { $entity = new $busModel(); } } $form = new $busForm($entity); // action if (isset($save)) { if ($form->setFromPost()->validate()->isValid()) { $entity->save(); Session::adminSuccess('saved', '/tools/quickview/#!/' . $module); } Session::set('adminError', $form->getValidation()->getMessage()); } // view $this->setTpl(); // nav $entities = \Rebond\Util\File::getFolders('Rebond/Bus/'); $tplNav = new Template(Template::SITE, ['admin', 'tools']); $tplNav->set('entities', $entities); $tplNav->set('active', $module); // main $tplMain = new Template(Template::MODULE, ['Bus', $module]); $tplMain->set('item', $form); // layout $this->tplLayout->set('column1', $tplMain->render('bus-editor')); // master $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col')); $this->tplMaster->set('navSide', $tplNav->render('nav')); $this->tplMaster->set('page', 'tools'); $this->tplMaster->addJs('/js/tinymce/tinymce.min.js'); $this->tplMaster->set('jsLauncher', 'toolsQuickEdit'); return $this->tplMaster->render('tpl-default'); }
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'); }
public function tpl() { // auth Util\Auth::isAdminAuthorized($this->signedUser, 'admin.designer', true, '/'); $mainTpl = Util\File::getFiles('views/' . \Rebond\Config::getPath('siteFolder')); $count = count($mainTpl); for ($i = 0; $i < $count; $i++) { if (Util\File::getExtension($mainTpl[$i]) != 'tpl') { unset($mainTpl[$i]); } } $appFolders = Util\File::getFolders('Rebond/App/'); $appTpl = []; foreach ($appFolders as $app) { $appTpl[$app] = []; $templates = \Rebond\Util\File::getFiles('Rebond/App/' . $app . '/template/'); $appTpl[$app] = array_diff($templates, ['admin-editor.tpl', 'admin-form.tpl', 'admin-listing.tpl', 'admin-trail.tpl', 'admin-view.tpl']); } // view $this->setTpl(); // main $tplMain = new Util\Template(Util\Template::SITE, ['admin', 'designer']); $tplMain->set('mainTpl', $mainTpl); $tplMain->set('appTpl', $appTpl); // layout $this->tplLayout->set('column1', $tplMain->render('tpl-listing')); // master $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col')); return $this->tplMaster->render('tpl-default'); }