本文整理汇总了PHP中core\View::renderadmintemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP View::renderadmintemplate方法的具体用法?PHP View::renderadmintemplate怎么用?PHP View::renderadmintemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\View
的用法示例。
在下文中一共展示了View::renderadmintemplate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
if (Session::get('loggedin')) {
Url::redirect('admin');
}
$model = new \Models\Admin\Auth();
$data['title'] = 'Login';
if (isset($_POST['submit'])) {
$username = $_POST['member_username'];
$password = $_POST['member_password'];
if (Password::verify($_POST['member_password'], $model->getHash($_POST['member_username'])) == 0) {
$error[] = 'Wrong username of password';
} else {
$data['user_infos'] = $model->get_user_infos($_POST['member_username']);
Session::set('member_id', $data['user_infos'][0]->member_id);
Session::set('member_username', $username);
Session::set('member_password', '' . $password . '');
Session::set('loggedin', true);
Url::redirect('admin');
}
}
View::renderadmintemplate('loginheader', $data);
View::render('admin/login', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例2: index
public function index()
{
$data['title'] = 'Admin';
View::renderadmintemplate('header', $data);
View::render('admin/admin', $data);
View::renderadmintemplate('footer', $data);
}
示例3: robots
public function robots()
{
$data['title'] = 'Edit robots.txt';
$data['robots_url'] = 'robots.txt';
if (!file_exists($data['robots_url'])) {
$data['robots_status'] = '
<button type="button" class="btn btn-danger">Empty file</button>
<button type="button" class="btn btn-danger">File doesn\'t exist</button>
';
} else {
//fichier existe
$data['robots_content'] = file_get_contents($data['robots_url']);
if (!empty($data['robots_content'])) {
$data['robots_status'] = '
<button type="button" class="btn btn-success">File not empty</button>
<button type="button" class="btn btn-success">File exist</button>
';
} else {
$data['robots_status'] = '
<button type="button" class="btn btn-danger">Empty file</button>
<button type="button" class="btn btn-success">File exist</button>
';
}
}
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
file_put_contents($data['robots_url'], $_POST['robots']);
Session::set('message', 'File updated');
Url::redirect('admin/seo/robots');
}
View::renderadmintemplate('header', $data);
View::render('admin/seo/robots', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例4: edit
public function edit($id)
{
$data['title'] = 'Edit Member';
$data['row'] = $this->model->get_member($id);
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($username == '') {
$error[] = 'Username is required';
}
if ($password == '') {
$error[] = 'Password is required';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error[] = 'Email is not valid';
}
if (!$error) {
$postdata = array('member_username' => $username, 'member_password' => Password::make($password), 'member_email' => $email);
$where = array('member_id' => $id);
$this->model->update_member($postdata, $where);
Session::set('message', 'Member Updated');
Url::redirect('admin/members');
}
}
View::renderadmintemplate('header', $data);
View::render('admin/members/edit', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例5: edit
public function edit($id)
{
$data['title'] = 'Edit Category';
$data['token'] = Csrf::makeToken();
$data['row'] = $this->model->get_category($id);
$data['categories'] = $this->model->get_categories();
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$category_name = $_POST['category_name'];
$category_id_parent = $_POST['category_id_parent'];
$category_description = $_POST['category_description'];
if ($category_name == '') {
$error[] = 'Name is required';
}
if (!$error) {
$postdata = array('category_name' => $category_name, 'category_id_parent' => $category_id_parent, 'category_description' => $category_description);
$where = array('category_id' => $id);
$this->model->update_category($postdata, $where);
Session::set('message', 'Category Updated');
Url::redirect('admin/categories/edit/' . $id . '');
}
}
if (isset($_POST['seo'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$category_title = $_POST['category_title'];
$category_meta_desc = $_POST['category_meta_desc'];
$category_meta_robots = $_POST['category_meta_robots'];
$category_url = $_POST['category_url'];
if ($category_url == '') {
$error[] = 'Url is required';
}
if (!$error) {
$postdata = array('category_title' => $category_title, 'category_meta_desc' => $category_meta_desc, 'category_meta_robots' => $category_meta_robots, 'category_url' => Url::generateUrl($category_url));
$where = array('category_id' => $id);
$this->model->update_category($postdata, $where);
Session::set('message', 'SEO Informations Updated');
Url::redirect('admin/categories/edit/' . $id . '');
}
}
if (isset($_POST['image'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
if ($_FILES['category_image']['size'] > 0) {
if (!is_dir('images/categories/' . $id . '')) {
mkdir('images/categories/' . $id . '');
}
$extension_img = substr($_FILES['category_image']['name'], -4);
$name_without_extension = substr($_FILES['category_image']['name'], 0, -4);
$image_name = Url::generateUrl($name_without_extension) . $extension_img;
//var_dump($_FILES['brand_image']['name']); exit;
$file = 'images/categories/' . $id . '/' . $image_name;
$file_mini = 'images/categories/' . $id . '/m-' . $image_name;
move_uploaded_file($_FILES['category_image']['tmp_name'], $file);
move_uploaded_file($_FILES['category_image']['tmp_name'], $file_mini);
$img = new SimpleImage($file);
$img->save($file, 70);
$img_mini = new SimpleImage($file);
$img_mini->load($file)->fit_to_width(300)->fit_to_height(300)->save($file_mini);
$postdata = array('category_image' => $file);
$where = array('category_id' => $id);
$this->model->update_category($postdata, $where);
Session::set('message', 'Image Updated');
Url::redirect('admin/categories/edit/' . $id . '');
}
}
View::renderadmintemplate('header', $data);
View::render('admin/categories/edit', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例6: edit
public function edit($id)
{
$data['title'] = 'Edit Post';
$data['token'] = Csrf::makeToken();
$data['row'] = $this->posts->get_post($id);
$data['posts'] = $this->posts->get_posts();
$data['categories'] = $this->categories->get_all_categories();
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$post_name = $_POST['post_name'];
$post_category_id = $_POST['post_category_id'];
$post_short_description = $_POST['post_short_description'];
$post_long_description = $_POST['post_long_description'];
if ($post_name == '') {
$error[] = 'Name is required';
}
if (!$error) {
$postdata = array('post_name' => $post_name, 'post_category_id' => $post_category_id, 'post_short_description' => $post_short_description, 'post_long_description' => $post_long_description, 'post_modified' => (new \DateTime())->format('Y-m-d H:i:s'));
$where = array('post_id' => $id);
$this->posts->update_post($postdata, $where);
Session::set('message', 'Post Updated');
Url::redirect('admin/posts/edit/' . $id . '');
}
}
if (isset($_POST['seo'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$post_title = $_POST['post_title'];
$post_meta_description = $_POST['post_meta_description'];
$post_meta_robots = $_POST['post_meta_robots'];
$post_url = $_POST['post_url'];
if ($post_url == '') {
$error[] = 'Url is required';
}
if (!$error) {
$postdata = array('post_title' => $post_title, 'post_meta_description' => $post_meta_description, 'post_meta_robots' => $post_meta_robots, 'post_url' => Url::generateUrl($post_url), 'post_modified' => (new \DateTime())->format('Y-m-d H:i:s'));
$where = array('post_id' => $id);
$this->posts->update_post($postdata, $where);
Session::set('message', 'SEO Informations Updated');
Url::redirect('admin/posts/edit/' . $id . '');
}
}
if (isset($_POST['image'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
if ($_FILES['post_image']['size'] > 0) {
if (!is_dir('images/posts/' . $id . '')) {
mkdir('images/posts/' . $id . '');
}
$extension_img = substr($_FILES['post_image']['name'], -4);
$name_without_extension = substr($_FILES['post_image']['name'], 0, -4);
$image_name = Url::generateUrl($name_without_extension) . $extension_img;
//var_dump($_FILES['brand_image']['name']); exit;
$file = 'images/posts/' . $id . '/' . $image_name;
$file_mini = 'images/posts/' . $id . '/m-' . $image_name;
move_uploaded_file($_FILES['post_image']['tmp_name'], $file);
move_uploaded_file($_FILES['post_image']['tmp_name'], $file_mini);
$img = new SimpleImage($file);
$img->save($file, 70);
$img_mini = new SimpleImage($file);
$img_mini->load($file)->fit_to_width(850)->fit_to_height(355)->save($file_mini);
$postdata = array('post_image' => $image_name, 'post_modified' => (new \DateTime())->format('Y-m-d H:i:s'));
$where = array('post_id' => $id);
$this->posts->update_post($postdata, $where);
Session::set('message', 'Image Updated');
Url::redirect('admin/posts/edit/' . $id . '');
}
}
View::renderadmintemplate('header', $data);
View::render('admin/posts/edit', $data, $error);
View::renderadmintemplate('footer', $data);
}