/** * Render main admin page with settings current template */ public function index() { if ($_POST) { try { switch ($_POST['action']) { // Upload template from pc or url case 'upload': $this->upload(); showMessage(lang('Template was successfully uploaded.', 'template_manager')); break; // Install template // Install template case 'install': $this->install(); break; // Set logo anf favicon // Set logo anf favicon case 'setLogoFav': $this->setLogoFav(); showMessage(lang('Changes saved.', 'template_manager')); break; // Delete template // Delete template case 'delete': $template_name = $this->input->post('addData'); $this->deleteTemplate($template_name); showMessage(lang('Template was successfully deleted.', 'template_manager')); break; // Download template // Download template case 'download': $template_id = $this->input->post('addData'); $this->getRemoteTemplate($template_id); showMessage(lang('Template was successfully downloaded.', 'template_manager')); ajax_redirect('/admin/components/init_window/template_manager/#list', 600); break; // Setting some params // Setting some params default: $component = $this->input->post('handler'); $this->currentTemplate->getComponent($component)->setParams(); break; } } catch (\Exception $e) { showMessage($e->getMessage(), '', 'r'); } } else { $listRemote = TemplateManager::getInstance()->listRemote(); if (count($listRemote['Template'])) { $freeTpl = array(); foreach ($listRemote['Template'] as $tpl) { $freeTpl[$tpl['Name']] = $tpl['IsFree']; } } $this->registerJsVars(); \CMSFactory\assetManager::create()->registerStyle('style_admin')->registerStyle('jquery.fancybox-1.3.4')->registerScript('jquery.fancybox-1.3.4.pack')->registerScript('script_admin')->setData(array('freeTpl' => $freeTpl, 'templateToPay' => TemplateManager::getTemplateToPay(), 'template' => $this->currentTemplate, 'templates' => TemplateManager::getInstance()->listLocal(), 'remoteTemplates' => $_GET['remote_templates'] ? TemplateManager::getInstance()->listRemote() : array(), 'currTpl' => $this->currentTemplate->name))->renderAdmin('main'); } }
public function save() { $post = $this->group->get_postdata(); if ($post['id']) { $this->group->update($post['id'], $post); flashdata('Grupo {name} atualizado com sucesso!', $post); save_log('Atualizou grupo: {id} -> {name}', $post); } else { $post['id'] = $this->group->save($post); flashdata('Grupo {name} cadastrado com sucesso!', $post); save_log('Cadastrou grupo: {id} -> {name}', $post); } ajax_redirect('groups'); }
public function save() { $post = $this->user->get_postdata(); if ($_POST['password']) { $post['password'] = SHA1($_POST['password']); } if ($_FILES) { $this->load->library('my_upload'); $post['photo'] = $this->my_upload->upload(); } if ($post['id']) { $this->user->update($post['id'], $post); flashdata('Usuário {name} atualizado com sucesso!', $post); save_log('Atualizou Usuário: {id} -> {name}', $post); } else { $post['id'] = $this->user->save($post); flashdata('Usuário {name} cadastrado com sucesso!', $post); save_log('Cadastrou Usuário: {id} -> {name}', $post); } ajax_redirect('users'); }