当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme::update方法代码示例

本文整理汇总了PHP中Theme::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::update方法的具体用法?PHP Theme::update怎么用?PHP Theme::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


在下文中一共展示了Theme::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processUpdate

 public function processUpdate()
 {
     if (Tools::getIsset('id_theme') && Tools::getIsset('name') && Tools::getIsset('directory')) {
         $theme = new Theme((int) Tools::getValue('id_theme'));
         $theme->name = Tools::getValue('name');
         $theme->directory = Tools::getValue('directory');
         $theme->default_left_column = Tools::getValue('default_left_column');
         $theme->default_right_column = Tools::getValue('default_right_column');
         $nb_product_per_page = (int) Tools::getValue('product_per_page');
         if ($nb_product_per_page == 0) {
             $nb_product_per_page = 1;
         }
         $theme->product_per_page = $nb_product_per_page;
         if ($this->context->shop->id_theme == (int) Tools::getValue('id_theme')) {
             Configuration::updateValue('PS_PRODUCTS_PER_PAGE', $nb_product_per_page);
         }
         if (isset($_FILES['image_preview']) && $_FILES['image_preview']['error'] == 0) {
             if (@getimagesize($_FILES['image_preview']['tmp_name']) && !ImageManager::validateUpload($_FILES['image_preview'], 300000)) {
                 move_uploaded_file($_FILES['image_preview']['tmp_name'], _PS_ALL_THEMES_DIR_ . $theme->directory . '/preview.jpg');
             } else {
                 $this->errors[] = $this->l('Image not valid');
                 $this->display = 'form';
                 return false;
             }
         }
         $theme->update();
     }
     Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminThemes') . '&conf=29');
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:29,代码来源:AdminThemesController.php

示例2: executeUpdate

 public function executeUpdate($request)
 {
     $this->prepareUpdate();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->form->bind($request->getParameter('theme'), $request->getFiles('theme'));
         if ($this->form->isValid()) {
             $theme = Theme::update($this->form->getValues(), $this->getUser()->getUser());
             $this->redirect('/theme/read?id=' . $theme->getId());
         }
     }
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:11,代码来源:actions.class.php

示例3: processApplyConfigs

 public function processApplyConfigs()
 {
     $id_theme = Context::getContext()->shop->id_theme;
     $theme_name = Context::getContext()->shop->theme_name;
     $data = simplexml_load_file(_PS_ALL_THEMES_DIR_ . $theme_name . '/samples/themeconfig.xml');
     if (!$data) {
         $this->_html["error"][] = "Can not find  field in themes/LEOTHEME/themeconfig.xml";
         return false;
     }
     foreach ($data->fields as $fields) {
         if (isset($fields->attributes()->objectName) && $fields->attributes()->objectName && $fields->attributes()->objectName == 'theme') {
             $json = json_encode($fields->field);
             $theme = json_decode($json, TRUE);
             $new_theme = new Theme($id_theme);
             foreach ($theme as $k => $field) {
                 $new_theme->{$k} = $field;
             }
             if ($new_theme->update()) {
                 foreach ($data->fields as $items) {
                     if ($items->attributes()->objectName == "theme_meta") {
                         $jsons = json_encode($items);
                         $item = json_decode($jsons, TRUE);
                         $meta = $this->getMetaById($id_theme);
                         if (count($item) > 0) {
                             $this->deleteMeta($id_theme);
                         }
                         foreach ($item['field'] as $row) {
                             $this->addMeta($row, $id_theme);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:35,代码来源:DataSample.php

示例4: executeUpdate

 public function executeUpdate($request)
 {
     $object = $this->getRequestParameter('object');
     $user = User::getByApiKey($request->getParameter('login_id'), $request->getParameter('api_key'));
     if (!$user) {
         $output = '<rsp stat="fail"><err code="2" msg="login_id and api_key do not match" /></rsp>';
     } elseif ($object == 'application') {
         $form = new ApplicationForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url')));
         if ($form->isValid()) {
             $application = Application::update($form->getValues(), $user);
             if ($application) {
                 $output = '<rsp stat="ok">' . $application->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update application." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'comment') {
         $form = new CommentForm();
         $application_id = $module_id = $theme_id = null;
         if ($request->getParameter('application_id')) {
             $application_id = $request->getParameter('application_id');
         }
         if ($request->getParameter('module_id')) {
             $module_id = $request->getParameter('module_id');
         }
         if ($request->getParameter('theme_id')) {
             $theme_id = $request->getParameter('theme_id');
         }
         $form->bind(array('comment' => $request->getParameter('comment'), 'application_id' => $application_id, 'module_id' => $module_id, 'theme_id' => $theme_id));
         if ($form->isValid()) {
             $comment = Comment::update($form->getValues(), $user);
             $output = '<rsp stat="ok">' . $comment->getXML() . '</rsp>';
         } else {
             $output = '<rsp stat="fail"><err code="3" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'module') {
         $form = new ModuleForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url'), 'application_id' => $request->getParameter('application_id')));
         if ($form->isValid()) {
             $module = Madule::update($form->getValues(), $user);
             if ($module) {
                 $output = '<rsp stat="ok">' . $module->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update module." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme') {
         $form = new ThemeForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description')), $request->getFiles());
         if ($form->isValid()) {
             $theme = Theme::update($form->getValues(), $user);
             if ($theme) {
                 $output = '<rsp stat="ok">' . $theme->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="5" msg="Unable to update theme." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="5" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme_group') {
         $output = '<rsp stat="fail"><err code="6" msg="This object is not supported for update" /></rsp>';
     } elseif ($object == 'user') {
         $form = new UserForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'password' => $request->getParameter('password'), 'password2' => $request->getParameter('password'), 'email' => $request->getParameter('email'), 'role' => null));
         if ($form->isValid()) {
             $update_user = User::update($form->getValues(), $user);
             if ($update_user) {
                 $output = '<rsp stat="ok">' . $update_user->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="7" msg="Unable to update user." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="7" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     }
     $this->output = $output;
     $this->setTemplate('index');
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:83,代码来源:actions.class.php


注:本文中的Theme::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。