/** * * @param array $params * @param string $posts */ public function processRequest(array $params = null, $posts = null) { try { if (isset($posts['data']['current'])) { $this->setCurrent(str_replace('_', DS, $posts['data']['current'])); } $filter = new Prepare(); $foldername = $filter->filter($posts['data']['foldername']); $this->setDestination($this->getCurrent() . $foldername); if (!is_dir($this->getStorage()->getDocumentRoot() . self::ASSET_PATH . DS . $this->getDestination())) { if (is_writable($this->getStorage()->getDocumentRoot() . self::ASSET_PATH . DS . $this->getCurrent())) { $this->makeDirectory($this->getDestination()); $this->setDestination(self::ASSET_PATH . DS . $this->getDestination()); $this->setFsCurrent($this->getCurrent() . $posts['data']['ident']); $this->readAndCopy(); if (strlen($posts['data']['makecollection']) >= 2) { $this->createAssetCollection($posts['data']['makecollection'], $posts['data']['ident']); } return array('success' => true); } else { return array('error' => 'no_write_permissions'); } } else { return array('warn' => 'folder_name_exist'); } } catch (\Exception $e) { return array('error' => $e->getMessage()); } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { if (strlen($datas['url']) == 0) { $filter = new Prepare(); $datas['url'] = $filter->filter($datas['label']); } $datas['scope'] = $datas['url']; $msg = parent::save($datas, $entity); if (isset($datas['webNavigations']) && $datas['webNavigations'] > '0') { $this->addPageInNavigation($datas, $this->getLastInsertId()); } $this->emptyCache('contentinum_public_pages'); return $msg; } else { $setRedirect = false; if (isset($datas['redirect']) && '1' === $datas['redirect']) { $insert['redirect'] = $entity->url; $insert['webPagesId'] = $entity; $insert['statuscode'] = '301'; $setRedirect = true; } if ('index' === $entity->url) { unset($datas['url']); } $msg = parent::save($datas, $entity, $stage, $id); if (true === $setRedirect) { $this->setRedirect($insert); } $this->emptyCache('contentinum_public_pages'); return $msg; } }
/** * * @param unknown $entries * @return multitype:multitype:string unknown multitype:multitype:string unknown */ private function build($entries) { switch ($this->configure['modulFormat']) { case 'listdatas': return $entries; break; default: $result = array(); $filter = new Prepare(); foreach ($entries as $entry) { $organisation = $filter->filter($entry->organisation); if (preg_match('/\\bkreisstadt-/', $organisation)) { $orga = str_replace('kreisstadt-', '', $organisation); } if (preg_match('/\\bstadt-/', $organisation)) { $orga = str_replace('stadt-', '', $organisation); } if (preg_match('/gemeinde-/', $organisation)) { $orga = str_replace('gemeinde-', '', $organisation); } if (strlen($entry->imgSource) == 0) { $entry->imgSource = '/accounts/' . $entry->fieldtypes->typescope . '/' . $organisation . '.jpg'; } $result[$orga] = $entry->toArray(); } ksort($result); return $result; } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $filter = new Prepare(); // $filename = $this->getStorage($this->getSl()->get('contentinum_files_storage_manager'))->getDocumentRoot() . DS . $this->entity->getCurrentPath(); $filename .= DS . $filter->filter($datas['name']); file_put_contents($filename, $datas['content']); }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $filter = new Prepare(); $datas['scope'] = $filter->filter($datas['name']); parent::save($datas, $entity, $stage, $id); } else { $filter = new Prepare(); $datas['scope'] = $filter->filter($datas['name']); parent::save($datas, $entity, $stage, $id); } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $datas['publish'] = 'yes'; $filter = new Prepare(); if (!isset($datas['fieldName']) || strlen($datas['fieldName']) == 0) { $filter = new Prepare(); $datas['fieldName'] = str_replace('-', '', $filter->filter($datas['label'])); } else { $datas['fieldName'] = str_replace('-', '', $filter->filter($datas['fieldName'])); } unset($filter); if (!isset($datas['fieldDomid']) || strlen($datas['fieldDomid']) == 0) { $datas['fieldDomid'] = $datas['fieldName']; } $datas['itemRang'] = $this->sequence('webForms', $datas['webForms'], 'itemRang') + 1; parent::save($datas, $entity); } else { $msg = parent::save($datas, $entity, $stage, $id); return $msg; } }
public function __invoke($content, $groupIdent, $template, $contentstyles, array $specified = null) { $this->setTemplate($template); $str = ''; $i = 0; $html = ''; $headercontent = array(); $filter = new Prepare(); $tabspanel = $this->tabspanel; foreach ($content as $entry) { if ($groupIdent == $entry->webContentgroup) { $panelId = $filter->filter($entry->webContent->title); if (0 === $i) { $headercontent[] = '<a id="' . $panelId . '-label" href="#' . $panelId . '" role="tab" aria-selected="true" aria-controls="' . $panelId . '">' . $entry->webContent->title . '</a>'; } else { $headercontent[] = '<a id="' . $panelId . '-label" href="#' . $panelId . '" role="tab" aria-controls="' . $panelId . '">' . $entry->webContent->title . '</a>'; } //. '-label'; if (0 === $i) { $active = $this->tabspanel; $active['grid']['attr']['class'] .= ' ' . $this->active; $active['grid']['attr']['id'] = $panelId; $active['grid']['attr']['aria-labelledby'] = $panelId . '-label'; $str .= $this->deployRow($active, $this->view->contribution($entry->webContent, $contentstyles)); } else { $tabspanel['grid']['attr']['id'] = $panelId; $tabspanel['grid']['attr']['aria-labelledby'] = $panelId . '-label'; $str .= $this->deployRow($tabspanel, $this->view->contribution($entry->webContent, $contentstyles)); } $i++; } } $tabstitle = $this->tabstitle; $i = 0; $navlist = ''; foreach ($headercontent as $tbtitle) { if (0 === $i) { $tabstitle['grid']['attr']['class'] .= ' ' . $this->active; $navlist .= $this->deployRow($tabstitle, $tbtitle); } else { $navlist .= $this->deployRow($this->tabstitle, $tbtitle); } $i++; } $html .= $this->deployRow($this->tabsnav, $navlist); $html .= $this->deployRow($this->tabscontent, $str); return $html; }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $filter = new Prepare(); if (strlen($datas['optionValue']) === 0) { $datas['optionValue'] = $datas['optionLabel']; } $datas['optionValue'] = str_replace('-', '', $filter->filter($datas['optionValue'])); unset($filter); parent::save($datas, $entity); } else { $msg = parent::save($datas, $entity, $stage, $id); return $msg; } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $datas['tagGroup'] = 'newsblogstags'; $filter = new Prepare(); $datas['tagScope'] = $filter->filter($datas['tagName']); unset($filter); parent::save($datas, $entity, $stage, $id); } else { $filter = new Prepare(); $datas['tagScope'] = $filter->filter($datas['tagName']); unset($filter); parent::save($datas, $entity, $stage, $id); } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $filter = new Prepare(); $datas['title'] = strip_tags($datas['headline']); $datas['treeIdent'] = $filter->filter($datas['title']); parent::save($datas, $entity); } else { $filter = new Prepare(); $datas['title'] = strip_tags($datas['headline']); $msg = parent::save($datas, $entity, $stage, $id); $this->emptyPublicCache('navigation' . $entity->id); return $msg; } }
/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $datas['accountName'] = ''; $filter = new Prepare(); $datas['organisationScope'] = $filter->filter($datas['organisation']); unset($filter); $datas['accountId'] = Id::get(); parent::save($datas, $entity, $stage, $id); } else { $filter = new Prepare(); $datas['organisationScope'] = $filter->filter($datas['organisation']); unset($filter); parent::save($datas, $entity, $stage, $id); } }
/** * Create accordion elements * * @param array $content * @param array $template * @param unknown $medias * @param unknown $widgets * @param array $specified * @return Ambigous <string, multitype:> */ public function __invoke($entries, $groupIdent, $template, $contentstyles, array $specified = null) { if (is_array($template) && !empty($template)) { $this->setTemplate($template); } else { $viewTemplate = $this->view->groupstyles[static::VIEW_LAYOUT_KEY]; if (isset($viewTemplate[self::VIEW_TEMPLATE])) { $this->setTemplate($viewTemplate[self::VIEW_TEMPLATE]); } } $i = 0; $filter = new Prepare(); $accordion = ''; foreach ($entries as $entry) { if ($groupIdent == $entry->webContentgroup) { $ident = $filter->filter($entry->webContent->title); $content = $this->content; $content['grid']['attr']['id'] = $ident; if (false !== $this->active && 0 === $i) { $content['grid']['attr']['class'] = $content['grid']['attr']['class'] . ' ' . $this->active; } $str = $this->deployRow($content, $this->view->contribution($entry->webContent, $contentstyles)); $content = array(); $body = $this->body; $body['grid']['content:after:outside'] = $str; $body['grid']['attr']['controls'] = $ident; $body['grid']['attr']['href'] = '#' . $ident; if (0 === $i) { $body['grid']['attr']['aria-selected'] = 'true'; $body['row']['attr']['aria-hidden'] = 'false'; } $accordion .= $this->deployRow($body, $entry->webContent->title); $i++; } } return $this->deployRow($this->wrapper, $accordion); }
public function __invoke($content, $groupIdent, $template, $contentstyles, array $specified = null) { $this->setTemplate($template); if (null !== $specified) { $this->setSpecified($specified); } $str = ''; $i = 0; $filter = new Prepare(); $grid = $this->getTemplateProperty('body', 'grid', 'element'); foreach ($content as $entry) { if ($groupIdent == $entry->webContentgroup) { $attr = $this->getTemplateProperty('body', 'grid', 'attr'); $panelId = $filter->filter($entry->webContent->title); if (0 === $i) { $this->headercontent[] = '<a href="#' . $panelId . '" role="tab" tabindex="0" aria-selected="true" controls="' . $panelId . '">' . $entry->webContent->title . '</a>'; } else { $this->headercontent[] = '<a href="#' . $panelId . '" role="tab" tabindex="0" aria-selected="false" controls="' . $panelId . '">' . $entry->webContent->title . '</a>'; } $str .= '<' . $grid; if (0 === $i) { $attr['class'] .= ' ' . $this->active; $attr['aria-hidden'] = 'false'; } else { $attr['aria-hidden'] = 'true'; } $attr['id'] = $panelId; $str .= HtmlAttribute::attributeArray($attr) . '>'; $str .= $this->view->contribution($entry->webContent, $contentstyles); $str .= '</' . $grid . '>'; $i++; } } $attr = false; $factory = new HtmlElements(new FactoryElement()); $row = $this->getTemplateProperty('body', 'row', 'element'); if ($row) { $factory->setContentTag($row); $attr = $this->getTemplateProperty('body', 'row', 'attr'); if (false !== $attr) { $factory->setTagAttributtes(false, $attr, 0); $attr = false; } } $factory->setHtmlContent($str); $str = ''; $tabBody = $factory->display(); $factory = new HtmlElements(new FactoryElement()); $row = $this->getTemplateProperty('header', 'row', 'element'); if ($row) { $factory->setContentTag($row); $attr = $this->getTemplateProperty('header', 'row', 'attr'); if (false !== $attr) { $factory->setTagAttributtes(false, $attr, 0); $attr = false; } } $grid = $this->getTemplateProperty('header', 'grid', 'element'); $i = 0; foreach ($this->headercontent as $headerentry) { $attr = $this->getTemplateProperty('header', 'grid', 'attr'); $str .= '<' . $grid; if (0 === $i) { $attr['class'] .= ' ' . $this->active; } $str .= HtmlAttribute::attributeArray($attr); $str .= '>'; $str .= $headerentry; $str .= '</' . $grid . '>'; $i++; } $factory->setHtmlContent($str); $tabHeader = $factory->display(); return $tabHeader . $tabBody; }