當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Theme::create方法代碼示例

本文整理匯總了PHP中Theme::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Theme::create方法的具體用法?PHP Theme::create怎麽用?PHP Theme::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Theme的用法示例。


在下文中一共展示了Theme::create方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store a newly created theme in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('name' => 'required', 'description' => 'required', 'thumbnail' => 'required|image', 'version' => '', 'powerful_id' => 'required', 'category_id' => 'required');
     $validator = Validator::make($data = Input::except('images'), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /**
      * Convert list id powerful to json
      */
     $data['powerful_id'] = json_encode($data['powerful_id']);
     /**
      * Upload theme thunbnail
      */
     $tb_name = md5(time() . Input::file('thumbnail')->getClientOriginalName()) . '.' . Input::file('thumbnail')->getClientOriginalExtension();
     Input::file('thumbnail')->move($this->path, $tb_name);
     $tb_path = $this->path . '/' . $tb_name;
     $data['thumbnail'] = $tb_path;
     //create new theme
     $theme = Theme::create($data);
     //create theme images
     if (Input::has('theme_images')) {
         $theme_images = Input::get('theme_images');
         foreach ($theme_images as $image) {
             $idata = array('image' => $image['url'], 'name' => $image['name'], 'theme_id' => $theme->id);
             ThemeImage::create($idata);
         }
     }
     /**
      * Create theme logs
      * #Initial released.
      */
     ThemeLog::create(['description' => '#Initial released.', 'changed_date' => new Datetime(), 'theme_id' => $theme->id]);
     return Redirect::route('admin.themes.index')->with('message', 'Item had created!');
 }
開發者ID:vnzacky,項目名稱:exp_services,代碼行數:40,代碼來源:ThemesController.php

示例2: installTheme

 public function installTheme()
 {
     try {
         $this->full_path = $this->extractToTemporary();
         $success = $this->getAndCheckConfig();
         $this->copyFiles();
         $this->copyScreenshot();
         $theme = \Theme::create(array('name' => $this->config['name'], 'version' => $this->config['version'], 'author' => $this->config['author'], 'description' => $this->config['description'], 'directory' => $this->config['directory'], 'screenshot' => $this->screenshot, 'target' => $this->target));
         $this->cleanup();
         return $this->listener->installerSucceeds('backend/theme-manager', 'The theme was installed successfully');
     } catch (Exception $e) {
         return $this->listener->installerFails($e->getMessage());
     }
 }
開發者ID:ratno,項目名稱:Doptor,代碼行數:14,代碼來源:ThemeInstaller.php

示例3: add

 public function add()
 {
     $inst = new Theme($this->request->get('name'), $this->application);
     $errors = array();
     $validator = $this->buildValidator();
     $validator->isValid();
     if ($inst->isExistingTheme()) {
         $validator->triggerError('name', $this->translate('_err_theme_exists'));
     }
     if ($errors = $validator->getErrorList()) {
         return new JSONResponse(array('errors' => $errors));
     } else {
         $inst->create();
         return new JSONResponse($inst->toArray(), 'success', $this->translate('_theme_created'));
     }
 }
開發者ID:saiber,項目名稱:www,代碼行數:16,代碼來源:ThemeController.php

示例4: ajoutActivite

 public function ajoutActivite()
 {
     $this->load->model("Theme");
     $this->load->model("Activite");
     switch ($_SERVER['REQUEST_METHOD']) {
         case 'GET':
             $data['themes'] = Theme::getAll();
             $this->load->view("ajoutActivite", $data);
             break;
         case 'POST':
             if ($_POST['idTheme'] == -1) {
                 // Theme inexistant
                 if (Theme::exist($_POST['nomTheme'])) {
                     // rediriger sur la page du formulaire
                     $_SESSION["messagee"] = "Le theme existe déja";
                     header("Location:" . base_url() . "index.php/activites/gestionActivites");
                     exit;
                     break;
                 } else {
                     // créer le theme puis l'activite
                     $id = Theme::create($_POST['nomTheme']);
                     $x = Activite::create($_POST['nomActivite'], $_POST['descriptionActivite'], $id);
                     $_SESSION["messagee"] = "Insertion effectuée avec succès";
                     header("Location:" . base_url() . "index.php/activites/gestionActivites");
                     exit;
                     break;
                 }
             } else {
                 // Theme existe
                 Activite::create($_POST['nomActivite'], $_POST['descriptionActivite'], $_POST['idTheme']);
                 $_SESSION["messagee"] = "Insertion effectuée avec succès";
                 header("Location:" . base_url() . "index.php/activites/gestionActivites");
                 exit;
                 break;
             }
     }
 }
開發者ID:LaCongolexicomatisation,項目名稱:CodeIgniter-3.0.3,代碼行數:37,代碼來源:activites.php

示例5: seedThemes

 /**
  * Seed the themes
  *
  * return @void
  */
 private function seedThemes()
 {
     $this->info('---- Seeding new themes ----');
     $base_uri = $this->argument('uri');
     $taxonomy_uri = $this->argument('taxonomy_uri');
     if (empty($taxonomy_uri)) {
         $taxonomy_uri = $base_uri;
     }
     // Try to get the themes from the ns.thedatatank.com (semantic data)
     try {
         $this->info('Trying to fetch triples from the uri: ' . $base_uri);
         $themes_graph = \EasyRdf_Graph::newAndLoad($base_uri);
         if ($themes_graph->isEmpty()) {
             $this->info('We could not reach the online themes.');
         } else {
             $this->info('Found new themes online, removing the old ones.');
             // Empty the themes table
             \Theme::truncate();
         }
         // Fetch the resources with a skos:conceptScheme relationship
         $resources = $themes_graph->allOfType('skos:ConceptScheme');
         $taxonomy_uris = array();
         foreach ($resources as $r) {
             array_push($taxonomy_uris, $r->getUri());
         }
         if (!empty($taxonomy_uris)) {
             if (count($taxonomy_uris) == 1) {
                 $taxonomy_uri = $taxonomy_uris[0];
             } else {
                 // Check if one of the possible taxonomy uris compares to the uri of the document
                 foreach ($taxonomy_uris as $tax_uri) {
                     if ($base_uri == $tax_uri) {
                         $taxonomy_uri = $tax_uri;
                         break;
                     }
                     $this->error('None of the URIs that have the skos:ConceptScheme property matched the URI of the document, please specify the taxonomy URI as a second parameter.');
                 }
             }
         } else {
             $this->error('No resource has been found with a property of skos:ConceptScheme.');
         }
         // Fetch all of the themes
         foreach ($themes_graph->resourcesMatching('skos:inScheme') as $theme) {
             if ($theme->get('skos:inScheme')->getUri() == $taxonomy_uri) {
                 $uri = $theme->getUri();
                 $label = $theme->getLiteral('rdfs:label');
                 if (!empty($label) && !empty($uri)) {
                     $label = $label->getValue();
                     $this->info('Added ' . $uri . ' with label ' . $label);
                     \Theme::create(array('uri' => $uri, 'label' => $label));
                 }
             }
         }
         $this->info('Added new themes.');
     } catch (EasyRdf_Exception $ex) {
         $this->info('An error occurred when we tried to fetch online themes.');
     }
 }
開發者ID:jalbertbowden,項目名稱:core,代碼行數:63,代碼來源:DcatThemes.php

示例6: seedThemes

 /**
  * Seed the themes
  *
  * return @void
  */
 private function seedThemes()
 {
     $this->command->info('---- DCAT Themes ----');
     $uri = 'http://ns.thedatatank.com/dcat/themes#Taxonomy';
     $themes_fetched = false;
     // Try to get the themes from the ns.thedatatank.com (semantic data)
     try {
         $this->command->info('Trying to fetch new themes online.');
         $themes_graph = Graph::newAndLoad($uri);
         if ($themes_graph->isEmpty()) {
             $this->command->info('We could not reach the online themes.');
         } else {
             $themes_fetched = true;
             $this->command->info('Found new themes online, removing the old ones.');
             // Empty the themes table
             \Theme::truncate();
         }
         // Fetch all of the themes
         foreach ($themes_graph->resourcesMatching('skos:inScheme') as $theme) {
             if ($theme->get('skos:inScheme')->getUri() == $uri) {
                 $theme_uri = $theme->getUri();
                 $label = $theme->getLiteral('rdfs:label');
                 if (!empty($label) && !empty($theme_uri)) {
                     $label = $label->getValue();
                     $this->command->info('Added ' . $uri . ' with label ' . $label);
                     \Theme::create(array('uri' => $theme_uri, 'label' => $label));
                 }
             }
         }
         $this->command->info('Added new themes.');
     } catch (Exception $ex) {
         $this->command->info('An error occurred when we tried to fetch online themes.');
     }
     // If it's not available, get them from a file (json)
     if (!$themes_fetched) {
         $this->command->info('Trying to fetch the themes from the local json file containing a default set of themes.');
         $themes = json_decode(file_get_contents(app_path() . '/database/seeds/data/themes.json'));
         if (!empty($themes)) {
             $this->command->info('Found new themes, removing the old ones.');
             // Empty the themes table
             \Theme::truncate();
             foreach ($themes as $theme) {
                 \Theme::create(array('uri' => $theme->uri, 'label' => $theme->label));
             }
             if (!empty($themes)) {
                 $this->command->info('Added themes from the local json file.');
             }
         } else {
             $this->command->info('No themes were found in the local json file, the old ones will not be replaced.');
         }
     }
 }
開發者ID:tdt,項目名稱:core,代碼行數:57,代碼來源:DcatSeeder.php

示例7: run

 public function run()
 {
     // TEST DATA
     /*
     $contact = new Contact;
     $contact->first_name = 'Hillel';
     $contact->last_name = 'Hillel';
     $contact->email = 'hillelcoren@gmail.com';
     $contact->last_name = '2125551234';
     $client->contacts()->save($contact);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0001';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0002';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0003';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0004';
     $client->invoices()->save($invoice);
     */
     PaymentType::create(array('name' => 'Apply Credit'));
     PaymentType::create(array('name' => 'Bank Transfer'));
     PaymentType::create(array('name' => 'Cash'));
     PaymentType::create(array('name' => 'Debit'));
     PaymentType::create(array('name' => 'ACH'));
     PaymentType::create(array('name' => 'Visa Card'));
     PaymentType::create(array('name' => 'MasterCard'));
     PaymentType::create(array('name' => 'American Express'));
     PaymentType::create(array('name' => 'Discover Card'));
     PaymentType::create(array('name' => 'Diners Card'));
     PaymentType::create(array('name' => 'EuroCard'));
     PaymentType::create(array('name' => 'Nova'));
     PaymentType::create(array('name' => 'Credit Card Other'));
     PaymentType::create(array('name' => 'PayPal'));
     PaymentType::create(array('name' => 'Google Wallet'));
     PaymentType::create(array('name' => 'Check'));
     Theme::create(array('name' => 'amelia'));
     Theme::create(array('name' => 'cerulean'));
     Theme::create(array('name' => 'cosmo'));
     Theme::create(array('name' => 'cyborg'));
     Theme::create(array('name' => 'flatly'));
     Theme::create(array('name' => 'journal'));
     Theme::create(array('name' => 'readable'));
     Theme::create(array('name' => 'simplex'));
     Theme::create(array('name' => 'slate'));
     Theme::create(array('name' => 'spacelab'));
     Theme::create(array('name' => 'united'));
     Theme::create(array('name' => 'yeti'));
     InvoiceStatus::create(array('name' => 'Draft'));
     InvoiceStatus::create(array('name' => 'Sent'));
     InvoiceStatus::create(array('name' => 'Viewed'));
     InvoiceStatus::create(array('name' => 'Partial'));
     InvoiceStatus::create(array('name' => 'Paid'));
     Frequency::create(array('name' => 'Weekly'));
     Frequency::create(array('name' => 'Two weeks'));
     Frequency::create(array('name' => 'Four weeks'));
     Frequency::create(array('name' => 'Monthly'));
     Frequency::create(array('name' => 'Three months'));
     Frequency::create(array('name' => 'Six months'));
     Frequency::create(array('name' => 'Annually'));
     Industry::create(array('name' => 'Accounting & Legal'));
     Industry::create(array('name' => 'Advertising'));
     Industry::create(array('name' => 'Aerospace'));
     Industry::create(array('name' => 'Agriculture'));
     Industry::create(array('name' => 'Automotive'));
     Industry::create(array('name' => 'Banking & Finance'));
     Industry::create(array('name' => 'Biotechnology'));
     Industry::create(array('name' => 'Broadcasting'));
     Industry::create(array('name' => 'Business Services'));
     Industry::create(array('name' => 'Commodities & Chemicals'));
     Industry::create(array('name' => 'Communications'));
     Industry::create(array('name' => 'Computers & Hightech'));
     Industry::create(array('name' => 'Defense'));
     Industry::create(array('name' => 'Energy'));
     Industry::create(array('name' => 'Entertainment'));
     Industry::create(array('name' => 'Government'));
     Industry::create(array('name' => 'Healthcare & Life Sciences'));
     Industry::create(array('name' => 'Insurance'));
     Industry::create(array('name' => 'Manufacturing'));
     Industry::create(array('name' => 'Marketing'));
     Industry::create(array('name' => 'Media'));
     Industry::create(array('name' => 'Nonprofit & Higher Ed'));
     Industry::create(array('name' => 'Pharmaceuticals'));
     Industry::create(array('name' => 'Professional Services & Consulting'));
     Industry::create(array('name' => 'Real Estate'));
     Industry::create(array('name' => 'Retail & Wholesale'));
     Industry::create(array('name' => 'Sports'));
     Industry::create(array('name' => 'Transportation'));
     Industry::create(array('name' => 'Travel & Luxury'));
     Industry::create(array('name' => 'Other'));
     Industry::create(array('name' => 'Photography'));
     Size::create(array('name' => '1 - 3'));
     Size::create(array('name' => '4 - 10'));
//.........這裏部分代碼省略.........
開發者ID:poseidonjm,項目名稱:invoice-ninja,代碼行數:101,代碼來源:ConstantsSeeder.php


注:本文中的Theme::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。