public static function updateTagRelationCache($manualLock = false) { if (!$manualLock) { self::checkTagRelationCache('lock'); } try { $tagRelationsFile = sfConfig::get('sf_root_dir') . "/cache/objcache/tagsRelations.php"; $c = new Criteria(); $allTags = TagPeer::doSelect($c); $content = "<?php \n"; foreach ($allTags as $singleTag) { $c = new Criteria(); $c->add(TagrelationPeer::TAG_ID, $singleTag->getId()); $tagRelations = TagrelationPeer::doSelect($c); if ($tagRelations) { $elementsArr = "array("; foreach ($tagRelations as $tagRelation) { $elementsArr .= $tagRelation->getId() . ","; } $content .= "\$_TagRel['" . $singleTag->getTagId() . "'] = " . substr($elementsArr, 0, -1) . ");\n"; } } $content .= "\n?>"; if (FileHelper::writeFile($tagRelationsFile, $content)) { BackendService::loadTagsRelations(); } else { echo FileHelper::Log("Unable to write tag cache in: " . $tagRelationsFile, UtilsHelper::MSG_ERROR); } } catch (Exception $e) { echo FileHelper::Log("Unable to refresh tag cache: " . $e->getMessage(), UtilsHelper::MSG_ERROR); } if (!$manualLock) { self::checkTagRelationCache('unlock'); } }
public function executeSaveNewsI18n() { try { BackendService::objectSave($obj, $parent); $end_date = $obj->getEndDate(); $obj->setEndDate(substr($end_date, 0, 11) . '23:59:59'); $obj->save(null, $parent, $parameters["attrCulture"]); UtilsHelper::setBackendMsg("Saved"); } catch (Exception $e) { UtilsHelper::setBackendMsg("Error while saving: " . $e->getMessage(), "error"); } $this->forward(strtolower($this->getRequestParameter('moduleName')), "edit" . $this->getRequestParameter('documentName')); exit; }
public function executeEditListitemI18n() { BackendService::objectEdit('lists', 'ListitemI18n', $this); if ($user = $this->getUser()->getSubscriber()) { $this->userType = $user->getType(); } if ($this->obj) { if ($parentI18 = Document::getParentOf($this->obj->getId())) { if ($parent = Document::getParentOf($parentI18)) { $this->listType = $parent->getListType(); //if($parent->getListId() == "brokers") $this->showvalue = true; } } } }
public function executeEditMailinglist() { BackendService::objectEdit('newsletter', 'Mailinglist', $this); }
public function executeEditTag() { BackendService::objectEdit('admin', 'Tag', $this); }
public function executeEditProductI18n() { BackendService::objectEdit('products', 'ProductI18n', $this); }
public static function orderDocument($documentId, $up = true) { try { $con = Propel::getConnection(); $con->begin(); $c = new Criteria(); $c->add(RelationPeer::ID2, $documentId); $relation = RelationPeer::doSelectOne($c); $c = new Criteria(); $c->add(RelationPeer::ID1, $relation->getId1()); if ($up) { $c->addDescendingOrderByColumn(RelationPeer::SORT_ORDER); $criterion = $c->getNewCriterion(RelationPeer::SORT_ORDER, $relation->getSortOrder(), Criteria::LESS_THAN); } else { $c->addAscendingOrderByColumn(RelationPeer::SORT_ORDER); $criterion = $c->getNewCriterion(RelationPeer::SORT_ORDER, $relation->getSortOrder(), Criteria::GREATER_THAN); } $c->add($criterion); $previousRelation = RelationPeer::doSelectOne($c); if ($previousRelation) { $previousSortOrder = $previousRelation->getSortOrder(); $previousRelation->setSortOrder($relation->getSortOrder()); $previousRelation->save(); $relation->setSortOrder($previousSortOrder); $relation->save(); if (sfConfig::get('sf_cache_relations')) { if ($relation) { self::updateRelationCache($relation->getId1()); } } } if (SF_APP == "backend" && sfConfig::get('sf_cache_trees')) { $user = sfContext::getInstance()->getUser(); $moduleName = $user->getAttribute("currentModule"); $document = Document::getDocumentInstance($documentId); if ($up) { BackendService::updateTree($moduleName, $document, "UP"); //BackendService::updateTree($moduleName, $document, "UP", "right"); //BackendService::updateTree($moduleName, $document, "UP", "mce"); } else { BackendService::updateTree($moduleName, $document, "DOWN"); //BackendService::updateTree($moduleName, $document, "DOWN", "right"); //BackendService::updateTree($moduleName, $document, "DOWN", "mce"); } } $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } }
public function executeEditMedia() { // CROP SWF FIX if ($this->getRequestParameter("id") == "media") { $vars = explode("/", $_SERVER['REQUEST_URI']); $request = $this->getRequest(); if ($vars[6] == 'crop') { $request->setParameter("xpos", $vars[8]); $request->setParameter("ypos", $vars[10]); $request->setParameter("xsize", $vars[12]); $request->setParameter("ysize", $vars[14]); $request->setParameter("imgid", $vars[16]); $request->setParameter("ratio", $vars[18]); $request->setParameter("imgw", $vars[20]); $request->setParameter("imgh", $vars[22]); $result = $this->getPresentationFor("media", "crop"); } elseif ($vars[6] == 'rotate') { $request->setParameter("angle", $vars[8]); $request->setParameter("imgid", $vars[10]); $result = $this->getPresentationFor("media", "rotate"); } } ///////////////// BackendService::objectEdit("media", "Media", $this); $this->err = $this->getRequestParameter('err'); }
public function execute() { $this->response->info('Stopping service'); $this->backend_service->stop(); $this->executeNextCommand(); }
public function executeEditWishList() { BackendService::objectEdit('user', 'WishList', $this); }
public function execute() { $this->response->info('Restarting service'); $this->backend_service->start(); $this->response->success(); }
</tr> <div id="actionDiv"> <div id="actionDivHead"> <a onclick="$('#actionDiv').fadeOut();">close <img align="absmiddle" src="/images/icons/delete.png"></a> </div> <div id="actionDivContent"></div> </div> <?php foreach ($children as $child) { //if($filter && (!Document::checkOwner($child->getId()))) continue; $label = $child->getLabel(); $id = $child->getId(); $modelUp = get_class($child); $model = strtolower($modelUp); $status = strtolower(Document::getGenericDocument($child)->getPublicationStatus()); $i18nEls = BackendService::getLanguageBar($id, $sf_params->get("modulename")); ?> <tr> <td class="noborder"> <img src="/images/icons/status_<?php echo $status; ?> .png" border="0"> </td> <td> <?php echo $id; ?> </td> <td onclick="addToSelected(<?php echo $id;
public static function getDocumentsByTag($tagId) { try { if (BackendService::loadTagsRelations()) { if (array_key_exists('tagsRelations', $_SESSION) && array_key_exists($tagId, $_SESSION['tagsRelations'])) { $docs = $_SESSION['tagsRelations'][$tagId]; } foreach ($docs as $docId) { $document = self::getDocumentInstance($docId); if ($document) { $documents[] = $document; } } } else { $c = new Criteria(); $c->add(TagPeer::TAG_ID, $tagId); $tag = TagPeer::doSelectOne($c); if (!$tag) { return null; } $c = new Criteria(); $c->add(TagrelationPeer::TAG_ID, $tag->getId()); $tagRelations = TagrelationPeer::doSelect($c); $documents = array(); foreach ($tagRelations as $tagRelation) { $document = self::getDocumentInstance($tagRelation->getId()); if ($document) { $documents[] = $document; } } } return $documents; } catch (Exception $e) { return null; } }
public function executeDisplay() { $parameters = $this->getRequest()->getParameterHolder()->getAll(); $culture = $this->getUser()->getCulture(); $user = $this->getUser()->getSubscriber(); if (isset($parameters['rewriteUrl'])) { if (isset($parameters['pageref'])) { $document = Document::getDocumentInstance($parameters['pageref']); } else { if (BackendService::loadUrlRelations()) { if (array_key_exists('urlRelations', $_SESSION) && array_key_exists($parameters['rewriteUrl'], $_SESSION['urlRelations'])) { $documentId = $_SESSION['urlRelations'][$parameters['rewriteUrl']]; $document = Document::getDocumentInstance($documentId); } } else { $c = new Criteria(); $c->add(UrlrewritePeer::LABEL, $parameters['rewriteUrl']); $rewriteUrl = UrlrewritePeer::doSelectOne($c); /*if ($rewriteUrl && array_key_exists('sf_culture', $parameters)) { $document = Document::getDocumentInstance($rewriteUrl->getPageId()); if(substr(get_class($document), -4) == "I18n") { $parent = Document::getParentOf($rewriteUrl->getPageId()); $document = Document::getDocumentInstance($parent->getId()); } } else*/ if ($rewriteUrl) { $document = Document::getDocumentInstance($rewriteUrl->getPageId()); } } } if (!isset($document)) { $elements = explode("_", substr($parameters['rewriteUrl'], 0, -5)); $id = array_pop($elements); $key = $elements[0]; if (Document::getStatus($id) == UtilsHelper::STATUS_ACTIVE) { if ($key == "news") { if ($document = Document::getDocumentByExclusiveTag("website_page_newslist")) { $this->getRequest()->setParameter("month", $id); $this->getRequest()->setParameter("year", $elements[2]); $this->pageTitle = "News - " . $elements[1] . " " . $elements[2]; } } else { $rewritedDoc = Document::getDocumentInstance($id); if ($rewritedDoc) { $documentClass = get_class($rewritedDoc); if ($document = Document::getDocumentByExclusiveTag("website_page_" . $documentClass . "_detail")) { $this->getRequest()->setParameter($documentClass . "_id", $id); /*if(class_exists($documentClass."I18n")) $this->pageTitle = $rewritedDoc->getLabelI18n(); else*/ $this->pageTitle = $rewritedDoc->getLabel(); } } } } } } else { if (array_key_exists('pageref', $parameters) && is_numeric($parameters['pageref'])) { $document = Document::getDocumentInstance($parameters['pageref']); } else { $document = Document::getDocumentByExclusiveTag('website_page_home'); } } if (isset($document)) { //$page = Document::getDocumentByCulture($document, $culture); //if(Document::getStatus($document->getId()) != UtilsHelper::STATUS_ACTIVE) $this->forward404(); $page = $document; if ($page->getPublicationStatus() != UtilsHelper::STATUS_ACTIVE) { $this->forward404(); } } if (isset($page) && get_class($page) == "Page") { //$culture = $pageI18n->getCulture(); //$this->getUser()->setCulture($culture); } else { $page = null; } if ($page && $page->getIsSecure() && !$this->getUser()->isAuthenticated()) { $page = Document::getDocumentByExclusiveTag('website_page_login'); } $this->pageDocument = $page; $this->forward404Unless($page); $this->getRequest()->setParameter('pageref', $page->getId()); $this->getRequest()->setParameter('rewriteUrl', null); switch ($page->getPageType()) { // case "ACTIONPAGE": return $this->redirect($page->getActionName()); case "EXTERNAL": return $this->redirect($page->getUrl()); case "REFERENCE": $this->redirect(Document::getDocumentInstance($page->getPageId())->getHref()); break; } if (is_object($user)) { if ($user->getBackend()) { $this->setLayout('editPageContent'); $this->content = $this->getContent(true); } else { $this->content = $this->getContent(); } $this->setResponseParams($user); } else { $this->content = $this->getContent(); $this->setResponseParams(); } }
public function executeSavePageI18n() { try { $pageType = $this->getRequestParameter("attrPageType"); if (!$pageType) { $request = $this->getRequest(); $request->setParameter('attrPageType', 'CONTENT'); } BackendService::objectSave($obj, $parent); $obj->setRewriteUrl($this->getRequestParameter("attrRewriteUrl")); if (!$this->getRequestParameter("attrIsSecure")) { $obj->setIsSecure(NULL); } $obj->save(null, $parent, $this->getRequestParameter("attrCulture")); Urlrewrite::updateUrlRelationCache(); UtilsHelper::setBackendMsg("Saved"); } catch (Exception $e) { UtilsHelper::setBackendMsg("Error while saving: " . $e->getMessage(), "error"); } $this->forward(strtolower($this->getRequestParameter('moduleName')), "edit" . $this->getRequestParameter('documentName')); exit; }
public function executeEditKeyword() { BackendService::objectEdit('keywords', 'Keyword', $this); }