本文整理汇总了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!');
}
示例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());
}
}
示例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'));
}
}
示例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;
}
}
}
示例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.');
}
}
示例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.');
}
}
}
示例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'));
//.........这里部分代码省略.........