当前位置: 首页>>代码示例>>PHP>>正文


PHP Document::getParentOf方法代码示例

本文整理汇总了PHP中Document::getParentOf方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getParentOf方法的具体用法?PHP Document::getParentOf怎么用?PHP Document::getParentOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Document的用法示例。


在下文中一共展示了Document::getParentOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeSaveTag

 public function executeSaveTag()
 {
     try {
         $parameters = $this->getRequest()->getParameterHolder()->getAll();
         if ($parameters['id']) {
             $obj = Document::getDocumentInstance($parameters['id']);
             $parent = Document::getParentOf($parameters['id']);
         } else {
             $obj = new Tag();
             $parent = Document::getDocumentInstance($parameters['parent']);
         }
         foreach ($parameters as $key => $value) {
             if (!(strpos($key, 'attr') === false)) {
                 $function = 'set' . str_replace('attr', '', $key);
                 $obj->{$function}($value);
             }
         }
         if (!$parameters['attrExclusive']) {
             $obj->setExclusive(0);
         }
         $obj->save(null, $parent);
         UtilsHelper::setBackendMsg("Saved");
     } catch (Exception $e) {
         UtilsHelper::setBackendMsg("Error while saving: " . $e->getMessage(), "error");
     }
     PanelService::redirect('tag');
     exit;
 }
开发者ID:kotow,项目名称:work,代码行数:28,代码来源:actions.class.php

示例2: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $genDoc = Document::getGenericDocument($this);
             $genDoc->setPublicationStatus("WAITING");
             $genDoc->save();
             $this->setId($genDoc->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Newsletter.php

示例3: executeDetails2

 public function executeDetails2()
 {
     header("Content-type: text/html; charset=utf-8");
     $this->setLayout(false);
     $sm = Document::getDocumentInstance($this->getRequestParameter('SearchMatch_id'));
     $this->st = Document::getDocumentInstance($sm->getSearch());
     $this->sm = $sm;
     $this->parentBrand = Document::getParentOf($sm->getSearch(), "Brand");
     if (get_class($sm) == 'SearchMatch') {
         $fields = array('Label', 'ApplicationNumber', 'RegisterNumber', 'RegistrationDate', 'ApplicationDate', 'ExpiresOn', 'ViennaClasses', 'NiceClasses', 'RightsOwner', 'RightsRepresentative', 'OfficeOfOrigin', 'DesignatedContractingParty');
         $template = Document::getDocumentInstance($sm->getSearch());
         if ($template) {
             $searchOf = array();
             foreach ($fields as $field) {
                 $getter = "get" . $field;
                 $v = $template->{$getter}();
                 if ($v) {
                     $searchOf[] = $field;
                 }
             }
         }
         $this->searchOf = $searchOf;
         $this->brand = Document::getDocumentInstance($sm->getTrademark());
     } else {
         $this->brand = null;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:27,代码来源:actions.class.php

示例4: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         // get Lists object
         if (!$parent) {
             $parent = Document::getParentOf($this->getId());
         }
         // update list cache
         if (get_class($parent) == "Lists") {
             Lists::updateListCache($parent->getListId());
         }
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:Listitem.php

示例5: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Tag.php

示例6: executeEditListitemI18n

 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;
             }
         }
     }
 }
开发者ID:kotow,项目名称:work,代码行数:15,代码来源:actions.class.php

示例7: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (trim($this->__toString()) != "") {
             $this->setLabel($this->__toString());
         }
         switch ($this->getType()) {
             case "admin":
                 //case "site_admin":
                 $this->setBackend(1);
                 break;
             default:
                 $this->setBackend(0);
         }
         if ($this->getLogin() == "") {
             $this->setLogin($this->getEmail());
         }
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         /*if (!$this->getPublicationStatus())
         		{
         			$this->setPublicationStatus(UtilsHelper::STATUS_ACTIVE);
         		}*/
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:40,代码来源:User.php

示例8: array

}
?>
</div>
				</div>
			</div>
			<div class="qfSearchListWrap qfBoxBorderBg">
				
				<form method="POST">
				<input type="submit" value="Изтрий избрани" style="float:left"/>
				<br />
				<br />

				<?php 
$fields = array('Label', 'ApplicationNumber', 'RegisterNumber', 'RegistrationDate', 'ApplicationDate', 'ExpiresOn', 'ViennaClasses', 'NiceClasses', 'RightsOwner', 'RightsRepresentative', 'OfficeOfOrigin', 'DesignatedContractingParty');
foreach ($pager->getResults() as $doc) {
    $brand = Document::getParentOf($doc->getSearch(), "Brand");
    if (!$brand) {
        continue;
    }
    ?>
					
						<div class="qfRepImpSsItem">

							<div class="qfRepImpSsCol qfRepImpSsLeft">
								<div class="qfRepImpSsColInn">
								
								<div class="check_delete"><input type="checkbox" name="del[]" value="<?php 
    echo $doc->getId();
    ?>
"></div>
								
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:importSessionReportsSuccess.php

示例9: executeDelete

 public function executeDelete()
 {
     if ($user = $this->getUser()->getSubscriber()) {
         $userType = $user->getType();
     }
     if ($selectedDocuments = $this->getRequestParameter("selectedDocuments")) {
         sfConfig::set('sf_cache_relations', false);
         $selectedDocuments = explode(",", $selectedDocuments);
         foreach ($selectedDocuments as $docId) {
             $document = Document::getDocumentInstance($docId);
             if ($document) {
                 if ($userType != "admin") {
                     $class = get_class($document);
                     if ($class == "Lists" && $document->getListType() == "system") {
                         $alert = "no_delete";
                         continue;
                     } else {
                         if ($class == "Listitem") {
                             if ($parent = Document::getParentOf($document->getId())) {
                                 if ($parent->getListType() == "system") {
                                     $alert = "no_delete";
                                     continue;
                                 }
                             }
                         }
                     }
                 }
                 $document->delete();
             }
         }
         sfConfig::set('sf_cache_relations', true);
         Relation::updateRelationCache($this->getRequestParameter("p"));
     } else {
         $document = Document::getDocumentInstance($this->getRequestParameter('id'));
         if ($document) {
             $class = get_class($document);
             if ($userType != "admin") {
                 if ($class == "Lists" && $document->getListType() == "system") {
                     $alert = "no_delete";
                 } else {
                     if ($class == "Listitem") {
                         if ($parent = Document::getParentOf($document->getId())) {
                             if ($parent->getListType() == "system") {
                                 $alert = "no_delete";
                             }
                         }
                     }
                 }
             }
             if ($alert != "no_delete") {
                 $document->delete();
             }
         }
     }
     exit($alert);
 }
开发者ID:kotow,项目名称:work,代码行数:56,代码来源:actions.class.php

示例10: saveRelation

 public static function saveRelation($parents, $document, $updateCache = true)
 {
     if ($parents) {
         try {
             $con = Propel::getConnection();
             $con->begin();
             $docId = $document->getId();
             if (!is_array($parents)) {
                 $parents = array($parents);
             }
             foreach ($parents as $parent) {
                 $saveNew = true;
                 if ($parent) {
                     $parentId = $parent->getId();
                     $oldParentId = Document::getParentOf($docId, null, false);
                     if ($oldParentId) {
                         $relation = RelationPeer::retrieveByPk($oldParentId, $docId);
                         if ($oldParentId != $parentId) {
                             $relation->delete();
                         } else {
                             $saveNew = false;
                         }
                     }
                     if ($saveNew) {
                         $relation = new Relation();
                         $relation->setId1($parentId);
                         $relation->setId2($docId);
                         $relation->setDocumentModel1(get_class($parent));
                         $relation->setDocumentModel2(get_class($document));
                         $relation->setSortOrder($relation->getNextSortOrder($parent, $document));
                     }
                     $relation->save();
                 }
             }
             $con->commit();
             if (sfConfig::get('sf_cache_relations') && $updateCache && $parentId) {
                 self::updateRelationCache($parentId);
             }
             return true;
         } catch (Exception $e) {
             $con->rollback();
             throw $e;
         }
     }
 }
开发者ID:kotow,项目名称:work,代码行数:45,代码来源:Relation.php

示例11: validateAccountCreate

 public function validateAccountCreate()
 {
     // default values
     $result = true;
     $this->termsUrl = "";
     $this->type = "user";
     $this->company = null;
     $session_user = $this->getUser();
     $this->user = $session_user->getSubscriber();
     $request = $this->getRequest();
     if ($company = Document::getParentOf($session_user->getSubscriberId(), "Company")) {
         $this->company = $company;
     }
     if ($this->user) {
         $type = $this->user->getUserType();
         if ($type == 0) {
             $this->type = "company";
         }
     } elseif ($this->getRequestParameter("acc")) {
         $this->type = $this->getRequestParameter("acc");
     }
     if ($this->getRequestParameter('submitted') == "submitted") {
         $culture = $this->getUser()->getCulture();
         $params = $request->getParameterHolder()->getAll();
         foreach ($params as $key => $param) {
             if (!is_array($param)) {
                 ${$key} = trim($param);
             } else {
                 ${$key} = $param;
             }
         }
         /******* COMMON ********/
         /* firstname */
         /*if(empty($firstname))
         		{
         			$request->setError('errfirstname', "Please fill the 'First name' field");
         			$result = false;
         		}*/
         /* end firstname */
         /* e-mail */
         if (!$this->user) {
             if (empty($email)) {
                 $request->setError('erremail', "Please fill the 'Email' field");
                 $result = false;
             } else {
                 $myValidator = new sfEmailValidator();
                 $myValidator->initialize($this->getContext(), array());
                 $email = urldecode($email);
                 if (!$myValidator->execute($email, $error)) {
                     $request->setError('erremail', "This email is not valid");
                     $result = false;
                 } else {
                     if (!$this->user) {
                         $c = new Criteria();
                         $c->add(UserPeer::LOGIN, $email, Criteria::EQUAL);
                         $c1 = $c->getNewCriterion(UserPeer::LOGIN, $email, Criteria::EQUAL);
                         $c2 = $c->getNewCriterion(UserPeer::EMAIL, $email, Criteria::EQUAL);
                         $c1->addOr($c2);
                         $c->add($c1);
                         $user = UserPeer::doSelectOne($c);
                         if ($user) {
                             $request->setError('erremail', "Your email already exists in our database");
                             $result = false;
                         }
                     }
                 }
             }
         }
         /* end e-mail */
         /* pass */
         /*if(empty($password) && !$this->user)
         		{
         		$request->setError('errpassword', "Please fill the 'Password' field");
         		$result = false;
         		}
         		else
         		{
         		if(strlen($password) < 4 && !$this->user)
         		{
         		$request->setError('errpassword', "Your password must be more than 4 chars long");
         		$result = false;
         		}
         		elseif($this->user && strlen($password) > 0 && strlen($password) < 4)
         		{
         		$request->setError('errpassword', "Your password must be more than 4 chars long");
         		$result = false;
         		}
         		elseif(empty($confirmpass) && !$this->user)
         		{
         		$request->setError('errpassword', "Your password confirmation do not match");
         		$result = false;
         		}
         		elseif(empty($confirmpass) && $this->user && strlen($password) > 0)
         		{
         		$request->setError('errpassword', "Your password confirmation do not match");
         		$result = false;
         		}
         		else
         		{
         		if($password != $confirmpass)
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:actions.class.php

示例12: backend_select

function backend_select($name, $input = null, $option_tags = null, $options = array(), $methode = null)
{
    $code = getDivLabel($options, $name);
    if ($options['validate']) {
        $errSpan = "<span id='" . $name . "Error'></span>";
    }
    if ($options['unique']) {
        if (substr(get_class($input), -4) == "I18n") {
            $parentClass = substr(get_class($input), 0, -4);
        } else {
            $parentClass = null;
        }
        if ($input) {
            $children = Document::getChildrenOf(Document::getParentOf($input->getId(), $parentClass, false), ucfirst($options['model']));
            $objListitem = $input->{$methode}();
        } else {
            $children = Document::getChildrenOf(sfContext::getInstance()->getRequest()->getParameter('parent'), ucfirst($options['model']));
            $objListitem = null;
        }
        foreach ($children as $child) {
            $listitem = $child->{$methode}();
            if ($objListitem != $listitem) {
                unset($option_tags[$listitem]);
            }
        }
    }
    $code .= select_tag($name, options_for_select($option_tags, getVal($input, $methode, $name)), clearOptions($options, 1));
    $code .= $errSpan;
    return $code;
}
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:BackendFormHelper.php

示例13: foreach

<?php

/*
	echo MenuHelper::get_menu_by_tag("website_menu_main",
	array(
		'depth' => 1,
		'mainMasterClass' => 'menu-top',
		'currentAClass' => 'selected',
		'lastItemClass' => 'last'
		));
*/
$pageRef = $sf_params->get('pageref');
$topicId = Document::getParentOf($pageRef, null, false);
if ($sf_user->isAuthenticated()) {
    ?>
	<ul class="qfMainNavList">
<?php 
    $ind = 0;
    foreach ($menuItems as $tId => $p) {
        $ind++;
        ?>
		<li class="qfMNavList0<?php 
        echo $ind;
        ?>
 <?php 
        if ($tId == $topicId) {
            echo 'qfMNavListActive';
        }
        ?>
">
			<a href="<?php 
开发者ID:kotow,项目名称:work,代码行数:31,代码来源:mainNavSuccess.php

示例14: buildMenu

 public static function buildMenu($root, $menuItems = array(), $rootId = null, $options = array(), $siteMap = null)
 {
     $defOptionsArr = array("hasTags" => false, "mainMasterClass" => false, "mainMasterStyle" => false, "mainMasterId" => false, "mainClass" => false, "mainSubClass" => false, "firstItemClass" => false, "lastItemClass" => false, "itemClass" => false, "currentItemClass" => false, "mainTag" => false, "subTag" => false, "aClass" => false, "currentAClass" => false, "separator" => false, "depth" => false, "hideSecure" => false, "hideLabel" => false, "inPath" => false, "getIndex" => false, "splitElements" => 0);
     $class = null;
     foreach ($defOptionsArr as $okey => $oval) {
         if (!array_key_exists($okey, $options)) {
             $options[$okey] = false;
         }
     }
     if ($options['inPath'] && !$siteMap) {
         self::getSiteMap(null, $siteMap, 1000, 1, null, false, true);
     }
     $sfcontext = sfContext::getInstance();
     if (!$rootId) {
         if (is_object($root)) {
             $root = $root->getId();
         }
         $rootId = $root;
         $depth = isset($options['depth']) ? $options['depth'] : 1000;
         $menuItems = self::getSiteMap($rootId, $menuItems, $depth, 1, null, $options['getIndex']);
         if (isset($options["mainMasterClass"])) {
             $class = $options["mainMasterClass"];
         }
         //			if ($options["mainMasterId"])
         //				$masterId = $options["mainMasterId"];
         //			if ($options["mainMasterStyle"])
         //				$masterStyle = $options["mainMasterStyle"];
         $options['depth'] = $depth;
     }
     if (!isset($class) && isset($options["mainSubClass"])) {
         $class = $options["mainSubClass"];
     }
     if (isset($options["mainClass"])) {
         $class .= ' ' . $options["mainClass"];
     }
     if (isset($options["splitElements"]) && is_numeric($options["splitElements"])) {
         $splitElements = intval($options["splitElements"]);
     } else {
         $splitElements = 0;
     }
     $tag = $options["mainTag"] ? $options["mainTag"] : "ul";
     $subTag = $options["subTag"] && ($tag != "ul" || $tag != "ol") ? $options["subTag"] : "li";
     $add = '';
     if ($class) {
         $add .= ' class="' . $class . '"';
     }
     if (isset($options["mainMasterId"])) {
         $add .= ' id="' . $options["mainMasterId"] . '"';
     }
     if (isset($options["mainMasterStyle"])) {
         $add .= ' style="' . $options["mainMasterStyle"] . '"';
     }
     if ($tag != 'none') {
         $content = "<{$tag}" . $add . ">\n";
     }
     $i = 1;
     $j = $i;
     if (array_key_exists($rootId, $menuItems)) {
         $nbr = count($menuItems[$rootId]);
         // prepare "inPath" checker
         if ($options['inPath'] && ($options['currentItemClass'] || $options['currentAClass'])) {
             $pageref = $sfcontext->getRequest()->getParameter("pageref");
             if ($par = Document::getParentOf($pageref)) {
                 $parId = $par->getId();
                 if ($up = Document::getParentOf($parId)) {
                     $upId = $up->getId();
                 }
             }
         }
         foreach ($menuItems[$rootId] as $k => $item) {
             if (!$item['show']) {
                 continue;
             }
             // skip hidden items
             $newOptions = array();
             foreach ($options as $key => $option) {
                 $newOptions[$key] = str_replace("%INDEX%", $i, $option);
             }
             if ($newOptions['hideLabel']) {
                 $label = "";
             } else {
                 $label = $item['label'];
             }
             if ($item['model'] != "Website" && $item['model'] != "Menu") {
                 if ($newOptions['separator'] && $i > 1) {
                     $content .= $newOptions['separator'];
                 }
                 if ($newOptions["hideSecure"] == true) {
                     if (!isset($authentificated)) {
                         $user = $sfcontext->getUser();
                         $authentificated = $user->isAuthenticated();
                     }
                     if ($item["secure"] == 1 && $authentificated == false) {
                         continue;
                     }
                 }
                 $itemClass = '';
                 if ($newOptions['currentItemClass']) {
                     if (isset($newOptions['inPath'])) {
                         $existInPath = in_array($item['id'], $siteMap[$upId][$parId]['path']);
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:MenuHelper.php

示例15: executeProductDetails

 public function executeProductDetails()
 {
     $this->setLayout(false);
     $id = $this->getRequestParameter("Product_id");
     $category = $this->category = Document::getParentOf($id);
     //Document::getParentOf($id, "Category");
     if ($category) {
         $this->getRequest()->setParameter("Category_id", $this->category->getId());
     }
     $product = $this->product = Document::getDocumentInstance($id);
     if ($product) {
         $this->mainImg = Document::getDocumentInstance($product->getImage());
         $this->images = Document::getChildrenOf($id, "Media");
     }
 }
开发者ID:kotow,项目名称:work,代码行数:15,代码来源:actions.class.php


注:本文中的Document::getParentOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。