$success = true; } else { $p = new Page(); $p->template = 'basic-page'; $p->parent = wire('pages')->get("/kalender/termine/"); $p->title = $sanitizer->text($calendarioform); $p->name = $sanitizer->text($calendarioform); $p->addStatus(Page::statusHidden); $p->save(); $p = new Page(); $p->template = 'basic-page'; $parent = wire('pages')->get("name={$calendarioform}"); $p->parent = $parent->id; $p->name = $sanitizer->text($input->post->termintext); $p->title = $sanitizer->text($input->post->termintext); $p->addStatus(Page::statusHidden); $p->save(); $success = true; } } } function getTermine() { $termine = wire('pages')->get("/kalender/termine/")->children("include=hidden, sort=title"); $rechnungen = wire('pages')->get("/rechnungen/vorgaenge")->children("include=hidden, invoiceVorgangsart=R,buchungKontenInaktiv=0, sort=datum"); $lastdatum = "01-01-1970"; $count = 0; foreach ($termine as $termin) { echo "'{$termin->title}' : '"; $eintraege = $termin->children("include=hidden"); foreach ($eintraege as $eintrag) {
public function install(array $settings) { $field = $this->fields->get('email_images'); if (!$field) { $field = new Field(); $field->name = 'email_images'; $field->type = $this->modules->get('FieldtypeImage'); $field->label = 'Email Images'; $field->extensions = 'jpeg jpg gif png'; $field->maxFiles = 0; $field->unzip = 0; $field->descriptionRows = 1; $field->entityEncode = 1; $field->save(); $this->message("Created field: {$field->name}"); } $settings['images_field_id'] = $field->id; $field2 = $this->fields->get('email_image_body'); if (!$field2) { $field2 = new Field(); $field2->name = 'email_image_body'; $field2->type = $this->modules->get('FieldtypeTextarea'); $field2->label = 'Body Text'; $field2->textformatters = array('TextformatterEntities'); $field2->inputfieldClass = 'InputfieldTextarea'; $field2->rows = 5; $field2->save(); $this->message("Created field: {$field2->name}"); } // parent fieldgroup $parentFieldgroup = $this->fieldgroups->get('email-images'); if (!$parentFieldgroup) { $parentFieldgroup = new Fieldgroup(); $parentFieldgroup->name = 'email-images'; $parentFieldgroup->save(); $parentFieldgroup->add('title'); $parentFieldgroup->save(); $this->message("Created fieldgroup: {$parentFieldgroup->name}"); } // parent template $parentTemplate = $this->templates->get('email-images'); if (!$parentTemplate) { $parentTemplate = new Template(); $parentTemplate->name = 'email-images'; $parentTemplate->fieldgroup = $parentFieldgroup; $parentTemplate->allowPageNum = 1; $parentTemplate->save(); $this->message("Created template: {$parentTemplate->name}"); } $settings['parent_template_id'] = $parentTemplate->id; // child fieldgroup $childFieldgroup = $this->fieldgroups->get('email-image'); if (!$childFieldgroup) { $childFieldgroup = new Fieldgroup(); $childFieldgroup->name = 'email-image'; $childFieldgroup->save(); $childFieldgroup->add('title'); $childFieldgroup->add($field); // email_images $childFieldgroup->add($field2); // email_image_body $childFieldgroup->save(); $this->message("Created fieldgroup: {$childFieldgroup->name}"); } // child template $childTemplate = $this->templates->get('email-image'); if (!$template) { $childTemplate = new Template(); $childTemplate->name = 'email-image'; $childTemplate->fieldgroup = $childFieldgroup; $childTemplate->noChildren = 1; $childTemplate->parentTemplates = array($parentTemplate->id); $childTemplate->save(); $this->message("Created template: {$childTemplate->name}"); } $settings['child_template_id'] = $childTemplate->id; $parentPage = $this->pages->get('/email-images/'); if (!$parentPage->id) { $parentPage = new Page(); $parentPage->template = $parentTemplate; $parentPage->parent = '/'; $parentPage->name = 'email-images'; $parentPage->title = 'Email Images'; $parentPage->addStatus(Page::statusHidden); $parentPage->sortfield = '-created'; $parentPage->save(); $this->message("Created page: {$parentPage->path}"); } $settings['parent_page_id'] = $parentPage->id; // update settings for parentTemplate $parentTemplate->childTemplates = array($childTemplate->id); $parentTemplate->noParents = 1; $parentTemplate->save(); $this->modules->saveModuleConfigData('EmailImage', $settings); // install template file if (is_writable(wire('config')->paths->templates)) { if (@copy(dirname(__FILE__) . '/email-images.php', wire('config')->paths->templates . 'email-images.php')) { $this->message("Installed template file: email-images.php"); } } }
public function topicSave($options = array()) { $pages = wire('pages'); $templates = wire('templates'); $defaultOptions = array('topicContent' => '', 'topicTitle' => '', 'forumID' => 0, 'status' => 'published', 'pinned' => 0, 'locked' => 0, 'isEdit' => false, 'editID' => 0); // Use the defaults if any options are omitted $topic = array_merge($defaultOptions, $options); // Store the forum id from our options in a variable (readability) $forumID = $topic['forumID']; $currentDateTime = date('U'); // Unix timestamp // Update the topic if requested (edit == true) if ($topic['isEdit'] == true) { $editTopic = $pages->get($topic['editID']); $editTopic->of(false); $editTopic->hbb_topic_content = $topic['topicContent']; $editTopic->title = $topic['topicTitle']; $editTopic->hbb_edate = $currentDateTime; if ($topic['pinned'] == 1) { $editTopic->hbb_pinned = 1; } else { $editTopic->hbb_pinned = 0; } if ($topic['locked'] == 1) { $editTopic->hbb_locked = 1; } else { $editTopic->hbb_locked = 0; } $editTopic->save(); $editTopic->of(true); // Otherwise, save a new topic (edit == false) } else { // Save the topic $template_topic = $templates->get('hbb_topic'); $newTopic = new Page(); $newTopic->of(false); $newTopic->parent = $pages->get($forumID)->path(); $newTopic->template = $template_topic; $newTopic->title = $topic['topicTitle']; $newTopic->hbb_topic_content = $topic['topicContent']; $newTopic->hbb_ip = $this->wire('session')->getIP(); $newTopic->hbb_agent = $_SERVER['HTTP_USER_AGENT']; $newTopic->hbb_edate = $currentDateTime; $newTopic->hbb_date = $currentDateTime; $newTopic->hbb_ldate = $currentDateTime; if ($comment['locked'] == 1) { $newComment->hbb_locked = 1; } if ($comment['pinned'] == 1) { $newComment->hbb_pinned = 1; } if ($topic['status'] == 'published') { $newTopic->addStatus(Page::statusOn); } elseif ($topic['status'] == 'unpublished') { $newTopic->addStatus(Page::statusUnpublished); } $newTopic->save(); $newTopic->of(true); } }
/** * Check and update the given process page for hidden/visible status depending on useBookmarks setting * * @param Process $process * @param Page $page * */ public function checkProcessPage(Page $page) { $hidden = $page->isHidden(); if ($this->process->useBookmarks) { if ($hidden) { $page->removeStatus(Page::statusHidden); $page->save(); } } else { if (!$hidden) { $page->addStatus(Page::statusHidden); $page->save(); } } }