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


PHP Document::getGenericDocument方法代码示例

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


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

示例1: delete

 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         $genericDocument->delete();
         //deletes any tags for this document
         $c = new Criteria();
         $c->add(TagrelationPeer::TAG_ID, $this->getId());
         $tagRelations = TagrelationPeer::doSelect($c);
         foreach ($tagRelations as $tag) {
             $tag->delete();
         }
         parent::delete();
         $con->commit();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:27,代码来源:Tag.php

示例2: delete

 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         Document::getGenericDocument($this)->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:15,代码来源:News.php

示例3: save

 public function save($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:17,代码来源:Rootfolder.php

示例4: delete

 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         $genericDocument->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         // remove list cache
         Lists::deleteListCache($this->getListId());
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:19,代码来源:Lists.php

示例5: executeSetPublicationStatus

 public function executeSetPublicationStatus()
 {
     $items = explode(",", $this->getRequestParameter('items'));
     $status = $this->getRequestParameter('status');
     try {
         foreach ($items as $item) {
             $genericDocument = Document::getGenericDocument($item);
             $item = Document::getDocumentInstance($item);
             if ($genericDocument) {
                 $genericDocument->setPublicationStatus($status);
                 $genericDocument->save();
                 Document::cacheObj($item, null, true);
             }
         }
     } catch (Exception $e) {
         exit("A probleme occured: " . $e->getMessage());
     }
     exit("OK");
 }
开发者ID:kotow,项目名称:work,代码行数:19,代码来源:actions.class.php

示例6: foreach

		</td>
	</tr>
	<div id="actionDiv">
		<div id="actionDivHead">
			<a onclick="$('#actionDiv').fadeOut();">close <img align="absmiddle" src="/images/icons/delete.png"></a>&nbsp;
		</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 
开发者ID:kotow,项目名称:work,代码行数:31,代码来源:mainListSuccess.php

示例7: indexDocument

 public static function indexDocument($id)
 {
     ini_set("memory_limit", "2048M");
     try {
         $search_config_file = SF_ROOT_DIR . '/config/search.xml';
         $documents = simplexml_load_file($search_config_file);
         $document_instance = Document::getDocumentInstance($id);
         $document_name = get_class($document_instance);
         $search_index_path = SF_ROOT_DIR . '/cache/search/' . strtolower($document_name);
         $search_index = Zend_Search_Lucene::open($search_index_path);
         $common_field_val = "";
         $search_doc = new Zend_Search_Lucene_Document();
         $genDoc = Document::getGenericDocument($id);
         if ($genDoc) {
             $date = $genDoc->getCreatedAt();
         }
         foreach ($documents as $document) {
             $docClass = $document->attributes();
             if ($document_name == $docClass) {
                 $search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_id', $id, 'utf-8'));
                 $search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_date', $date, 'utf-8'));
                 $search_doc->addField(Zend_Search_Lucene_Field::Text('document_label', $document_instance->getLabel(), 'utf-8'));
                 $search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_type', $document_name, 'utf-8'));
                 /*					if(substr($document_name, -4) == "I18n")
                 					{
                 						$search_doc->addField(Zend_Search_Lucene_Field::Keyword('Culture', $document_instance->getCulture(), 'utf-8'));
                 					}*/
                 foreach ($document as $field_name) {
                     $attr = get_object_vars($field_name);
                     $attributes = $attr['@attributes'];
                     $getFunction = 'get' . $attributes['name'];
                     $fieldContent = "";
                     if ($attributes['linked']) {
                         $getFunctionLinked = 'get' . $attributes['linked'];
                         $linkedObj = Document::getDocumentInstance($document_instance->{$getFunction}());
                         if ($linkedObj) {
                             $fieldContent = $linkedObj->{$getFunctionLinked}();
                         }
                     } else {
                         $fieldContent = $document_instance->{$getFunction}();
                     }
                     $search_doc->addField(Zend_Search_Lucene_Field::Text($attributes['name'], $fieldContent, 'utf-8'));
                 }
                 $search_index->addDocument($search_doc);
                 $search_index->commit();
                 //$search_index->optimize();
             }
         }
     } catch (Exception $e) {
         FileHelper::Log("INDEXING > Error wile adding document " . $id . " | " . $e->getMessage(), UtilsHelper::MSG_ERROR);
         throw $e;
     }
     /*
     		try
     		{
     		$doc = Document::getDocumentInstance($id);
     		$docClass = get_class($doc);
     
     		$search_config_file = sfConfig::get('sf_root_dir').'/config/search.xml';
     		$documents = simplexml_load_file($search_config_file);
     
     		$index_path = sfConfig::get('sf_root_dir').'/cache/search/'.strtolower($docClass);
     		$search_index = Zend_Search_Lucene::open($index_path);
     
     		//if($doc && ($doc->getPublicationStatus() == UtilsHelper::STATUS_ACTIVE) && ($docClass == "User" && in_array($docFrontType, $userArr)))
     		{
     		foreach ($documents as $document)
     		{
     		$document_name = $document->attributes();
     		if($document_name == $docClass)
     		{
     		$common_field_val = null;
     		$profile = $profiles[$docFrontType];
     		$search_doc = new Zend_Search_Lucene_Document();
     		$search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_id', $id,'utf-8'));
     		$search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_label', $doc->getLabel(),'utf-8'));
     		$search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_type', $document_name,'utf-8'));
     		$search_doc->addField(Zend_Search_Lucene_Field::Text('Description', $doc->getDescription(), 'utf-8'));
     		$search_doc->addField(Zend_Search_Lucene_Field::Keyword('document_url', ""));
     
     		foreach ($document as $field_name)
     		{
     		$attr = get_object_vars($field_name);
     		$attributes = $attr['@attributes'];
     		$getFunction = 'get'.$attributes['name'];
     		$fieldContent = null;
     
     		if($attributes['linked'])
     		{
     		$getFunctionLinked = 'get'.$attributes['linked'];
     		$linkedObj = self::getDocumentInstance($doc->$getFunction());
     		if($linkedObj) $fieldContent = $linkedObj->$getFunctionLinked();
     		}
     		else
     		{
     		$fieldContent = $doc->$getFunction();
     		}
     
     		if($attributes['setTo'])
     		{
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:Document.php

示例8: setRewriteUrl

 public function setRewriteUrl($value)
 {
     try {
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         $con = Propel::getConnection();
         $con->begin();
         //			$rewriteUrl = UrlrewritePeer::retrieveByPk($value);
         $c = new Criteria();
         $c->add(UrlrewritePeer::PAGE_ID, $this->getId());
         $rewriteUrl = UrlrewritePeer::doSelectOne($c);
         //$rewriteUrl = Document::getDocumentInstance($value);
         $value = trim($value);
         if ($rewriteUrl) {
             if ($value != '') {
                 $value = Urlrewrite::checkRewriteUrl($value, $this->getId());
                 $rewriteUrl->setLabel($value);
                 $rewriteUrl->save(null, $this);
             } else {
                 if ($value == '') {
                     $rewriteUrl->delete();
                 }
             }
         } else {
             if ($value) {
                 $value = Urlrewrite::checkRewriteUrl($value, $this->getId());
                 $rewriteUrl = new Urlrewrite();
                 $rewriteUrl->setLabel($value);
                 $rewriteUrl->setPageId($this->getId());
                 $rewriteUrl->save(null, $this);
             }
         }
         $con->commit();
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
     return true;
 }
开发者ID:kotow,项目名称:work,代码行数:41,代码来源:Page.php

示例9: updateTree


//.........这里部分代码省略.........
             $i++;
         }
         //===============================================================
         if ($prevStart >= 0) {
             $docArr = array_slice($contentArray, $docStart, $docEnd - $docStart + 1);
             $prevArr = array_slice($contentArray, $prevStart, $prevEnd - $prevStart + 1);
             $start = array_slice($contentArray, 0, $prevStart);
             $last = array_slice($contentArray, $docEnd);
             $contentArray = array_merge($start, array_merge($docArr, array_merge($prevArr, $last)));
         }
     } elseif ($action == "DELETE") {
         // if document not in the Tree -> exit!
         if (!in_array($docId, $contentArray)) {
             return;
         }
         $newArray = array();
         $level = $contentArray[$docId]['level'];
         $deleteRest = false;
         foreach ($contentArray as $k => $v) {
             if ($k == $docId) {
                 //unset($contentArray[$k]);
                 $deleteRest = true;
             } elseif ($deleteRest && $contentArray[$k]['level'] <= $level) {
                 $deleteRest = false;
             }
             if (!$deleteRest) {
                 $newArray[$k] = $contentArray[$k];
             }
         }
         $contentArray = $newArray;
     } else {
         if (array_key_exists($docId, $contentArray)) {
             $contentArray[$docId]['label'] = addslashes($document->getLabel());
             $contentArray[$docId]['status'] = Document::getGenericDocument($document)->getPublicationStatus();
         } else {
             $parent = Document::getParentOf($docId, null, true, false);
             if ($parent) {
                 $parentId = $parent->getId();
             }
             // if document not in the Tree -> exit!
             $oldContentArray = $contentArray;
             $first = array_shift($oldContentArray);
             if (array_key_exists('treeParent', $first) && $first['treeParent'] == $first['id'] && !$contentArray[$parentId]) {
                 return;
             } else {
                 if (!$contentArray[$parentId]) {
                     $parentId = $first['id'];
                 }
             }
             $lmn = strtolower($moduleName);
             $lmn2 = $lmn;
             if ($lmn2 == "tag") {
                 $lmn2 = "admin";
             }
             $leftTree = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/apps/backend/modules/" . $lmn2 . "/config/" . $tree . "Tree.xml");
             $displayedObjects = array();
             foreach ($leftTree as $obj) {
                 if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
                     $displayedObjects[] = $obj['value'];
                 }
             }
             if (!in_array(get_class($document), $displayedObjects)) {
                 return null;
             }
             $docModel = get_class($document);
             $newItem = array();
开发者ID:kotow,项目名称:work,代码行数:67,代码来源:BackendService.class.php

示例10: delete

 public function delete($con = null)
 {
     $file = $this->getServerAbsoluteUrl();
     $thumb = $this->getServerAbsoluteThumbUrl();
     $filedeleted = true;
     $thumbdeleted = true;
     if (file_exists($file)) {
         $filedeleted = unlink($file);
     }
     if (file_exists($thumb)) {
         $thumbdeleted = unlink($thumb);
     }
     if (!$filedeleted) {
         FileHelper::Log("\tError: file '" . $file . "' could not be deleted!");
     }
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         if ($genericDocument) {
             $genericDocument->delete();
         }
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:31,代码来源:Media.php


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