예제 #1
0
 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;
 }
예제 #2
0
 public function executeForceLogin()
 {
     $access = false;
     $user = $this->getUser()->getSubscriber();
     if ($user && $user->getType() == "admin" && $user->getBackend() == 1) {
         $access = true;
     } else {
         $user = $this->getUser()->getAttribute('forceAutoLogAsAdmin');
         $access = true;
     }
     if ($access) {
         if ($this->getRequestParameter("fulid")) {
             $fulid = $this->getRequestParameter('fulid');
             $subscriber = Document::getDocumentInstance($fulid);
             if ($subscriber) {
                 $this->getUser()->setAttribute('forceAutoLogAsAdmin', $user);
                 $this->getUser()->signIn($subscriber);
                 $this->user = $subscriber;
                 if (!($page = Document::getDocumentByExclusiveTag("website_page_welcome"))) {
                     $page = Document::getDocumentByExclusiveTag("website_page_home");
                 }
                 if ($page) {
                     $href = $page->getHref();
                     $this->redirect($href);
                 }
             }
         }
     }
     exit;
 }
예제 #3
0
 public function executeDetail()
 {
     $this->setLayout(false);
     if ($id = $this->getRequestParameter('News_id')) {
         if ($this->news = Document::getDocumentInstance($id)) {
             //$reads = $this->news->getRds()+1;
             //$this->news->setRds($reads);
             //$this->news->save();
             $this->images = Document::getChildrenOf($id, 'Media', false);
         }
     }
 }
예제 #4
0
파일: Page.php 프로젝트: kotow/work
 public function getHref($absolute = true)
 {
     $protocol = "http://";
     $server = '';
     if ($absolute) {
         if ($_SERVER['HTTP_HOST']) {
             $host = $_SERVER['HTTP_HOST'];
         } else {
             $website = Document::getDocumentByExclusiveTag("website_website_default");
             if ($website) {
                 $host = $website->getUrl();
             }
         }
         if (!$host) {
             FileHelper::Log("Can not retrieve website URL or HTTP_HOST", UtilsHelper::MSG_ERROR);
         } else {
             if (substr($host, -1) != "/") {
                 $host .= "/";
             }
             if (substr($host, 0, 7) == "http://") {
                 $host = substr($host, 7);
             }
             if (substr($host, 0, 8) == "https://") {
                 $host = substr($host, 8);
             }
         }
         $server = $protocol . $host;
     }
     if ($this->getPageType() == "CONTENT") {
         if ($rewriteUrl = $this->getRewriteUrl()) {
             return $server . $rewriteUrl;
         }
         //			else
         //			{
         //				return "/website/display/pageref/".$this->getId();
         //			}
     } else {
         if ($this->getPageType() == "REFERENCE") {
             $ref = Document::getDocumentInstance($this->getPageId());
             return $ref->getHref($absolute);
         } else {
             if ($this->getPageType() == "EXTERNAL") {
                 return $this->getUrl();
             }
         }
     }
     if ($absolute) {
         return $server . "website/display/pageref/" . $this->getId();
     } else {
         return "/website/display/pageref/" . $this->getId();
     }
 }
예제 #5
0
 function executeDownload()
 {
     $media = Document::getDocumentInstance($this->getRequestParameter('id'));
     if ($media && get_class($media) == 'Media') {
         $name = $media->getLabel();
         header("Content-Disposition: attachment; filename=\"{$name}\"");
         header("Content-Type: " . $media->getFiletype());
         //header('Content-type: audio/mpeg3');
         //$location = "Location: http://" . $_SERVER['HTTP_HOST'] . str_replace("\\", "/", $media->getRelativeUrl())."?".time();
         $file = $media->getServerAbsoluteUrl();
         readfile($file);
     }
     exit;
 }
예제 #6
0
파일: Topic.php 프로젝트: kotow/work
 public function getIndexPage()
 {
     try {
         $c = new Criteria();
         $c->add(TagPeer::TAG_ID, 'website_page_index');
         $tag = TagPeer::doSelectOne($c);
         $c = new Criteria();
         $c->add(RelationPeer::ID1, $this->getId());
         $c->addJoin(RelationPeer::ID2, TagrelationPeer::ID);
         $c->add(TagrelationPeer::TAG_ID, $tag->getId());
         $relation = RelationPeer::doSelectOne($c);
         if ($relation) {
             $indexPage = Document::getDocumentInstance($relation->getId2());
             return $indexPage;
         } else {
             return null;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
예제 #7
0
</p>
                                        <!-- <p><b>Вид:</b> ---</p> -->
                                        <p><b>Държави в които е в сила:</b> <?php 
    echo $brand->getDesignatedContractingParty();
    ?>
</p>
                                        <!-- <p><b>Незащитени елементи:</b> ---</p> -->
                                    </div>  
                                </div>
                            </div>
 <?php 
    if ($parentBrand) {
        $src = '/images/trade-mark00.jpg';
        $src2 = '/images/trade-mark00.jpg';
        echo '<b>BOLD</b>';
        if ($img = Document::getDocumentInstance($parentBrand->getImage())) {
            $src = $img->getRelativeThumbUrl();
            $src2 = $img->getAbsoluteUrl();
        }
        ?>
                            <div class="qfSessFullColWrap qfSessCell qfSessCellMArTop qfSearchMatch">
                                <div class="qfSessBlockHeading"><h3>За следена марка</h3></div>
                                <div class="qfSessBlockCnt">
                                    <div class="qfSessLogoContainer">
                                        <a href="<?php 
        echo $src2;
        ?>
" target="_blank"><img src="<?php 
        echo $src;
        ?>
" alt="logo" /></a>
예제 #8
0
 public function executeProductsList()
 {
     $this->setLayout(false);
     $id = $this->getRequestParameter("Category_id");
     $category = $this->category = Document::getDocumentInstance($id);
     if ($category) {
         $this->products = Document::getChildrenOf($category, "Product", true);
     }
 }
예제 #9
0
 public function executeNewsletter()
 {
     $newsletter = Document::getDocumentInstance($this->getRequestParameter("newsletterId"));
     if ($newsletter) {
         $this->content = $newsletter->getContent();
     }
     $this->setLayout(false);
 }
예제 #10
0
        }
    }
    ?>
										</h3>
									</div>
								</a>
									</div>
							</div>
							<div class="qfRepImpSsCol qfRepImpSsRight">
								<div class="qfRepImpSsColInn">
									<div class="qfRepImpSsColInnName">
									
									<p>
									
									<?php 
    $template = Document::getDocumentInstance($doc->getSearch());
    if ($template) {
        $searchOf = array();
        foreach ($fields as $field) {
            $getter = "get" . $field;
            $v = $template->{$getter}();
            if ($v) {
                $searchOf[] = $field;
            }
        }
    }
    $img = null;
    if ($brand) {
        $img = $brand->getImage();
        if ($img) {
            ?>
예제 #11
0
파일: sfPakeMisc.php 프로젝트: kotow/work
function run_generate_cache($task, $args)
{
    ini_set("memory_limit", "2048M");
    ini_set("display_errors", 1);
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'dev');
    define('SF_DEBUG', false);
    sfConfig::set("sf_use_relations_cache", false);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    run_url_relations($task, $args);
    run_tags_relations($task, $args);
    echo_cms_title("GENERATING CACHE...");
    if (!class_exists("XMLParser")) {
        include sfConfig::get('sf_root_dir') . "/lib/tools/XMLParser.class.php";
    }
    if (!class_exists("FileHelper")) {
        include sfConfig::get('sf_root_dir') . "/lib/helper/FileHelper.php";
    }
    //echo_cms_sep();
    echo_cms("sf_cache_objects = " . sfConfig::get('sf_cache_objects'));
    echo_cms("sf_cache_relations = " . sfConfig::get('sf_cache_relations'));
    echo_cms("sf_cache_trees = " . sfConfig::get('sf_cache_trees'));
    //echo_cms_sep();
    if (count($args) > 0) {
        $relationsFlag = substr($args[0], 0, 3) == "rel";
        $listsFlag = substr($args[0], 0, 4) == "list";
        $cacheModel = $args[0];
        if (is_numeric($cacheModel)) {
            $obj = Document::getDocumentInstance($cacheModel);
            if ($obj) {
                $phpName = get_class($obj);
            } else {
                echo_cms_error("Object with ID=" . $cacheModel . " not found!");
                exit;
            }
        }
    }
    // parse schema file to make Schema.class.php
    $objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/schema.xml");
    $schemaFile = sfConfig::get('sf_root_dir') . "/config/Schema.class.php";
    $content = $content = "<?php\n class Schema\n{\n\n";
    echo_cms("Building " . $schemaFile . "... ");
    foreach ($objects as $obj) {
        if ($obj['tag'] == 'TABLE' && $obj['type'] == 'open') {
            $table = $obj['attributes']['PHPNAME'];
            if ($phpName && $phpName == $table) {
                $tableName = $obj['attributes']['NAME'];
            }
            $trees = explode(",", $obj['attributes']['TREE']);
            $content .= "\tpublic static function get" . $table . "Trees()\n\t{\n";
            $content .= "\t\treturn array(";
            foreach ($trees as $tree) {
                $content .= "'" . strtolower($tree) . "', ";
            }
            $content = substr($content, 0, -2);
            $content .= ");\n\t}\n\n";
            $content .= "\tpublic static function get" . $table . "Properties()\n\t{\n";
            $content .= "\t\treturn array(";
        }
        if ($obj['tag'] == 'COLUMN' && $obj['type'] == 'complete') {
            $property = $obj['attributes']['NAME'];
            $getProperty = UtilsHelper::convertFieldName($property);
            $content .= "'" . $getProperty . "', ";
        }
        if ($obj['tag'] == 'TABLE' && $obj['type'] == 'close') {
            $content = substr($content, 0, -2);
            $content .= ");\n\t}\n\n";
        }
    }
    $content .= "\n}";
    //echo_cms_sep();
    if (FileHelper::writeFile($schemaFile, $content)) {
        echo_cms($schemaFile . " writen successfully!");
    } else {
        echo_cms_error("Error writing " . $schemaFile . "!");
    }
    echo "\n";
    //echo_cms_sep();
    if (substr($args[0], 0, 5) == "schema") {
        echo_cms(" Done!");
        exit;
    }
    if (!$relationsFlag && !$listsFlag) {
        try {
            if (is_numeric($cacheModel)) {
                $obj = array();
                $obj['tag'] = 'OBJECT';
                $obj['type'] = 'complete';
                $obj['id'] = $cacheModel;
                $objects = array($obj);
                $exit = true;
            } elseif ($cacheModel) {
                $obj = array();
                $obj['tag'] = 'OBJECT';
                $obj['type'] = 'complete';
                $obj['value'] = $cacheModel;
                $objects = array($obj);
                $exit = true;
            } else {
                $objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/cachedObjects.xml");
            }
            foreach ($objects as $obj) {
                if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
                    if ($id = $obj['id']) {
                        $obj = Document::getDocumentInstance($id);
                        $model = get_class($obj);
                        $c = new Criteria();
                        $c->add($tableName . '.ID', $id);
                    } else {
                        $model = $obj['value'];
                        $c = new Criteria();
                    }
                    $classPeer = ucfirst($model) . "Peer";
                    //$c = new Criteria();
                    //$results = call_user_func(array($classPeer, 'doSelect'), $c);
                    $peerMethod = "doSelect";
                    $results = call_user_func(array($classPeer, $peerMethod), $c);
                    echo_cms("  Caching " . $model . " documents");
                    $ind = 0;
                    foreach ($results as $result) {
                        if ($ind % 20 == 0) {
                            echo $ind . "  .\r";
                        } else {
                            if ($ind % 10 == 0) {
                                echo $ind . "  o\r";
                            }
                        }
                        $ind++;
                        Document::cacheObj($result, $model, false);
                    }
                    echo_cms(" ====> " . $ind . " " . $model . " Document(s) cached.");
                    //echo_cms_sep();
                }
            }
            if ($exit) {
                exit;
            }
        } catch (Expection $e) {
            echo_cms_error(" Error: {$e}");
        }
    }
    if (!$listsFlag) {
        echo "\n";
        //echo_cms_sep();
        echo_cms("Writing relations cache");
        Relation::checkRelationCache('lock');
        try {
            $c = new Criteria();
            $c->addAscendingOrderByColumn('id1');
            $c->addAscendingOrderByColumn('document_model2');
            $c->addAscendingOrderByColumn('sort_order');
            $relations = RelationPeer::doSelect($c);
            $relationsFile = sfConfig::get('sf_root_dir') . "/cache/objcache/childrenRelations.php";
            echo_cms("Processing children :");
            $i = 0;
            $content = "<?php \n";
            $oldIDModel = '';
            $currIDModel = '';
            $idStr = '';
            foreach ($relations as $relation) {
                $currIDModel = $relation->getId1() . ':' . $relation->getDocumentModel2();
                if ($i == 0) {
                    $oldIDModel = $currIDModel;
                }
                $i++;
                echo $i . "\t\t\r";
                if ($currIDModel == $oldIDModel) {
                    $idStr .= "," . $relation->getId2();
                } else {
                    $idStr = substr($idStr, 1);
                    $content .= "\$_Rel[" . $oldId1 . "][\"" . $oldModel2 . "\"] = explode(\",\", \"" . $idStr . "\");\n";
                    $idStr = "," . $relation->getId2();
                }
                $oldIDModel = $currIDModel;
                $oldId1 = $relation->getId1();
                $oldModel2 = $relation->getDocumentModel2();
            }
            if ($idStr) {
                $idStr = substr($idStr, 1);
                $content .= "\$_Rel[" . $oldId1 . "][\"" . $oldModel2 . "\"] = explode(\",\", \"" . $idStr . "\");\n";
            }
            echo "\n";
            $content .= "\n?>";
            //echo_cms_sep();
            if (FileHelper::writeFile($relationsFile, $content)) {
                echo_cms($relationsFile . " written successfully");
            } else {
                echo_cms_error("Error writing " . $relationsFile . " !");
            }
            //echo_cms_sep();
        } catch (Exception $e) {
            echo "Error: " . $e->getMessage();
        }
        Relation::checkRelationCache('unlock');
    }
    if (!$relationsFlag) {
        echo "\n";
        //echo_cms_sep();
        echo_cms_title("Writing Lists cache");
        $listsRootFolder = Rootfolder::getRootfolderByModule("lists");
        if ($listsRootFolder) {
            $lists = Document::getChildrenOf($listsRootFolder->getId(), "Lists");
        }
        foreach ($lists as $list) {
            $listId = $list->getListId();
            echo "\t\tprocessing \"" . $listId . "\" list ...";
            $listPath = sfConfig::get('sf_root_dir') . "/cache/listscache/" . $listId . ".php";
            @unlink($listPath);
            $content = "<?php \n";
            $content .= "\$listItemsForSelect = array(\n";
            $items = Lists::getListitemsForSelect($listId, array(), false);
            foreach ($items as $key => $item) {
                $content .= "\"" . str_replace("\"", "\\\"", $key) . "\" => \"" . str_replace("\"", "\\\"", $item) . "\",\n";
            }
            $content .= ");\n?>";
            if (FileHelper::writeFile($listPath, $content)) {
                echo_cms(" Done!");
            } else {
                echo_cms_error(" Error!");
            }
        }
        //echo_cms_sep();
    }
    sfConfig::set("sf_use_relations_cache", true);
}
예제 #12
0
<?php

foreach ($pages as $p) {
    $page = Document::getDocumentByCulture($p, null, true);
    if (!$page) {
        continue;
    }
    $img = $page->getImage();
    $url = $page->getHref();
    $pic = Document::getDocumentInstance($img);
    if ($pic) {
        $desc = $pic->getDescription();
    }
    ?>
    
	<div class="grid_5">
		<h3 class="serif"><?php 
    echo $page->getLabel();
    ?>
</h3>
	    <p><a href="<?php 
    echo $url;
    ?>
"><img src="/media/display/thumb/230/id/<?php 
    echo $img;
    ?>
" width="190" alt="<?php 
    echo $desc;
    ?>
"/></a></p>
	    <p><?php 
예제 #13
0
 public function executeCrop()
 {
     $ratio = $this->getRequestParameter('ratio');
     $imgw = $this->getRequestParameter('imgw');
     $imgh = $this->getRequestParameter('imgh');
     $xpos = $this->getRequestParameter('xpos') / ($ratio / 10000);
     $ypos = $this->getRequestParameter('ypos') / ($ratio / 10000);
     $xsize = $this->getRequestParameter('xsize') / ($ratio / 10000);
     $ysize = $this->getRequestParameter('ysize') / ($ratio / 10000);
     if ($xsize < 0) {
         $xsize = $xsize * -1;
         $xpos = $xpos - $xsize;
     }
     if ($ysize < 0) {
         $ysize = $ysize * -1;
         $ypos = $ypos - $ysize;
     }
     if ($xpos + $xsize > $imgw) {
         $xsize = $imgw - $xpos;
     }
     if ($ypos + $ysize > $imgh) {
         $ysize = $imgh - $ypos;
     }
     $xsize = round($xsize);
     $ysize = round($ysize);
     $xpos = round($xpos);
     $ypos = round($ypos);
     $media = Document::getDocumentInstance($this->getRequestParameter('imgid'));
     if ($media) {
         $media->resizeImage(null, $ysize, $xsize, null, array($xpos, $ypos));
         $media->resizeImage("thumbs", 100);
         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>croped</result>";
     } else {
         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>error!</result>";
     }
     exit;
 }
예제 #14
0
파일: Document.php 프로젝트: kotow/work
 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'])
     		{
     		$common_field_val .= $fieldContent;
     		}
     		else
     		{
     		$search_doc->addField(Zend_Search_Lucene_Field::Text($attributes['name'], $fieldContent, 'utf-8'));
     		}
     		}
     
     		if($attributes['setTo'])
     		{
     		$pattern1 = '/[^a-zA-Z0-9 ]/';
     		$pattern2 = '/ .{1,2} /';
     		$replacement = '';
     		$replacement2 = ' ';
     		$common_field_val = preg_replace($pattern1, $replacement, $common_field_val);
     		$common_field_val = preg_replace($pattern2, $replacement2, $common_field_val);
     		$search_doc->addField(Zend_Search_Lucene_Field::Text($attributes['setTo'], $common_field_val, 'utf-8'));
     		}
     
     		$search_index->addDocument($search_doc);
     		}
     		}
     		}
     
     		$search_index->commit();
     		}
     		catch (Exception $e)
     		{
     		FileHelper::Log("INDEXING -> Error wile adding document ".$id." | ".$e->getMessage(), UtilsHelper::MSG_ERROR );
     		}*/
 }
예제 #15
0
파일: myUser.class.php 프로젝트: kotow/work
 public function getSubscriber()
 {
     if ($this->getSubscriberId()) {
         return Document::getDocumentInstance($this->getSubscriberId());
     }
 }
예제 #16
0
function panel_related($name, $input = null, $options = array(), $methode = null)
{
    $related = get_val($input, $methode, $name);
    $relatedArr = explode(";", $related);
    $out = get_field_wrapper($options, $name);
    $code = '<div id="relatedStock">';
    foreach ($relatedArr as $rel) {
        if ($rel) {
            $relObj = Document::getDocumentInstance($rel);
            if ($relObj = Document::getDocumentInstance($rel)) {
                $code .= '<div id="rel_' . $rel . '" class="rel_del" onclick="removeRelated(\'' . $rel . '\')">' . $relObj->getLabel() . '</div>';
            }
        }
    }
    $code .= '</div>';
    $code .= input_hidden_tag($name, $related, array('id' => 'related'));
    $code .= '<div style="clear: both;"></div>';
    if ($options['size']) {
        $size = $options['size'];
    } else {
        $size = 50;
    }
    if ($options['max']) {
        $max = $options['max'];
    } else {
        $max = 3;
    }
    //	$code .= '<input type="text" id="relate" autocomplete="off" size="'.$size.'" onfocus="document.getElementById(\'rl\').style.display = \'none\'"
    //	onkeyup="getRelated(this.value, document.getElementById(\'rl\'))">
    //	&nbsp;<input type="button" value="Find news" onclick="findRelated(document.getElementById(\'relate\').value, 1)">
    //	&nbsp;<input type="button" value="Find features" onclick="findRelated(document.getElementById(\'relate\').value, 2)">
    //	<div id="rl"></div>
    //';
    $code .= '<input type="text" id="relate" autocomplete="off" size="' . $size . '" onfocus="document.getElementById(\'rl\').style.display = \'none\'">
	&nbsp;<input type="button" value="Find news" onclick="getRelated(1, ' . $max . ')">
	&nbsp;<input type="button" value="Find features" onclick="getRelated(2, ' . $max . ')">
	<div id="rl"></div>
';
    return str_replace('##code##', $code, $out);
}
예제 #17
0
function backend_keywords($name, $input = null, $options = array(), $methode = null)
{
    $keywords = getVal($input, $methode, $name);
    if ($keywords) {
        $keywords = substr($keywords, 1, -1);
        $keywords = str_replace('][', ',', $keywords) . ',';
    }
    $keywordsArr = explode(",", $keywords);
    $code = '<div id="keywordsStock" style="width:325px">';
    foreach ($keywordsArr as $key) {
        $keyObj = Document::getDocumentInstance($key);
        if ($keyObj = Document::getDocumentInstance($key)) {
            $code .= '<div id="key_' . $key . '" class="s" onclick="removeKeyword(\'' . $key . '\')">' . $keyObj->getLabel() . '</div>';
        }
    }
    $code .= '</div>';
    $code .= input_hidden_tag($name, $keywords, array('id' => 'keywords'));
    $code .= '<br><div style="clear:both"></div>';
    $code .= getDivLabel($options, $name);
    if ($options['size']) {
        $size = $options['size'];
    } else {
        $size = 50;
    }
    $code .= '<input type="text" id="keyword" autocomplete="off" size="' . $size . '" onfocus="document.getElementById(\'fk\').style.display = \'none\'"
	onkeyup="getKeywords(this.value, document.getElementById(\'fk\'))">
	&nbsp<input type="button" value="' . $options['btnLabel'] . '" onclick="addKeyword(document.getElementById(\'keyword\').value)"><div id="fk"></div>';
    return $code;
}
예제 #18
0
파일: UtilsHelper.php 프로젝트: kotow/work
 public static function cleanURL($object, $fullUrl = false)
 {
     if (is_integer($object)) {
         $href = "object_not_found_" . $object . '.html';
         $object = Document::getDocumentInstance($object);
     }
     if ($object && is_object($object)) {
         $id = $object->getId();
         $href = UtilsHelper::cleanStr($object->getLabel()) . "_" . $id . '.html';
     } elseif ($object && is_array($object)) {
         $href = UtilsHelper::cleanStr($object['label']) . "_" . $object['id'] . '.html';
     }
     for ($i = 0; $i < 5; $i++) {
         $href = str_replace('--', '-', $href);
     }
     if (substr($href, 0, 1) == '-') {
         $href = substr($href, 1);
     }
     if ($fullUrl) {
         return 'http://' . $_SERVER['HTTP_HOST'] . '/' . $href;
     }
     return $href;
 }
예제 #19
0
?>

<?php 
if ($pager) {
    ?>
<div class="pictures_galery">
	<h1 ><?php 
    echo UtilsHelper::Localize('media.frontend.Gallery-Label', $lang);
    ?>
</h1>

	<?php 
    $i = 0;
    $y = 0;
    foreach ($pager->getResults() as $relation) {
        $pic = Document::getDocumentInstance($relation->getId2());
        ?>

	<?php 
        if ($y == 0) {
            ?>
		<div class="listPict">
	<?php 
            $d = false;
        }
        ?>

	<div class="<?php 
        if ($y == 0) {
            echo 'Pict1';
        } else {
예제 #20
0
			<div class="qfTrMarksFilter qfTrMarksFilter02">
				<input type="text" placeholder="search..." class="qfTrMrSearch" name="search">
			</div>
            <div class="qfTrMarkItemAddDel qfTrMarkItemAddDelTop">
                <a class="qfSessCtrlBtn qfSessCtrlPlus" href="<?php 
echo $addTrademarkURL;
?>
">Добави</a>
            </div>
		</div>

		<div class="qfTrTrColFull qfTrTrCol01" id="trademarks_container">
<?php 
foreach ($brands as $b) {
    $src = '/images/trade-mark00.jpg';
    if ($image = Document::getDocumentInstance($b->getImage())) {
        $src = $image->getRelativeThumbUrl();
    }
    ?>
			<div class="qfTrMarkItem qfTrMarkItemOpt_<?php 
    echo $b->getClientId();
    ?>
" data-sort="<?php 
    echo strtotime($b->getRegistrationDate());
    ?>
">
				<span title="delete" class="qfTrMarkItemDelete" id="<?php 
    echo $b->getId();
    ?>
">x</span>
				<div class="qfTrMarkPiece qfTrMarkPLogo">
예제 #21
0
파일: Relation.php 프로젝트: kotow/work
 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;
     }
 }
예제 #22
0
function frontend_droppable($name, $input = null, $options = array(), $methode = null)
{
    $code = frontend_hidden('attr' . ucfirst($name), $input, '', 'get' . ucfirst($name));
    $code .= getDivLabel($options, $name);
    $obj = Document::getDocumentInstance(getVal($input, $methode, $name));
    if ($options['width']) {
        $code .= frontend_hidden('thumbwidth', $options['width']);
    }
    if ($options['height']) {
        $code .= frontend_hidden('thumbheight', $options['height']);
    }
    if ($options['path']) {
        $thumbpath = $options['path'] . "/";
    }
    if ($options['path']) {
        $code .= frontend_hidden('thumbpath', $options['path']);
    }
    $code .= "<table><tr>";
    if ($obj) {
        $label = $obj->getLabel();
        $fileName = $obj->getFilename();
        if ($obj->isImage()) {
            $src = "/media/display/thumb/thumbs/id/" . $obj->getId();
            $code .= '<td 	class="attrImage"
							id="' . $name . '"
							name="' . $name . '">';
            $code .= '<img	align="absbottom"
							height="100"
							src="' . $src . '"/>';
            $code .= '</td><td valign="bottom">';
            $code .= '&nbsp;<img style="border:none" src="/images/icons/clear.gif" onclick="document.getElementById(\'' . $name . '\').innerHTML = \'&nbsp;\'; document.getElementById(\'attr' . ucfirst($name) . '\').value = \'\'; ">';
            $code .= '</td>';
        } else {
            $code .= '<td 	class="attrImage"
							id="' . $name . '"
							name="' . $name . '">' . $label . "<br>" . $fileName . '</td><td valign="bottom">';
            $code .= '&nbsp;<img style="border:none" src="/images/icons/clear.gif" onclick="document.getElementById(\'' . $name . '\').innerHTML = \'&nbsp;\'; document.getElementById(\'attr' . ucfirst($name) . '\').value = \'\'; ">';
            $code .= '</td>';
        }
    } else {
        $code .= '<td 	class="attrImage"
						id="' . $name . '"
						name="' . $name . '">&nbsp;</td><td valign="bottom">';
        $code .= '&nbsp;<img style="border:none" src="/images/icons/clear.gif" onclick="document.getElementById(\'' . $name . '\').innerHTML = \'&nbsp;\'; document.getElementById(\'attr' . ucfirst($name) . '\').value = \'\'; ">';
        $code .= '</td>';
    }
    $code .= "</tr></table>";
    return $code;
}
예제 #23
0
				<label for="rights_owner_address">Адрес на притежателя (нов): </label>
				<?php 
    echo frontend_textarea('rights_owner_address', $trademark, array('size' => '50x1'), 'getRightsOwnerAddress');
    ?>
				<label for="rights_representative">Представител: </label>
				<?php 
    echo frontend_input('rights_representative', $trademark, array(), 'getRightsRepresentative');
    ?>
				<label for="rights_representative_address">Адрес на представителя: </label>
				<?php 
    echo frontend_textarea('rights_representative_address', $trademark, array('size' => '50x1'), 'getRightsRepresentativeAddress');
    ?>
			</div>
<?php 
    $src = '/images/add-logo.jpg';
    if ($img = Document::getDocumentInstance($trademark->getImage())) {
        $src = $img->getRelativeThumbUrl();
    }
    ?>
			<div class="qfTwoCol qfTwoCol02">
				<h3 class="qfFmPieceHeading">Лого</h3>
				<div class="qfAddLogoContainer">
					<img alt="add logo" src="<?php 
    echo $src;
    ?>
">
				</div>
				<div class="qfFmCtrls">
					<!-- <input class="qfSubmitBtn" type="submit" value="Изберете файл ..."> -->
					<input disabled="disabled" placeholder="Choose File" id="uploadFile">
					<div class="fileUpload btn btn-primary">
예제 #24
0
 public function executeGetRichtextFields()
 {
     $this->setLayout(false);
     $template = $this->getRequestParameter('template');
     $templateFile = SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'website' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.xml';
     if (!is_file($templateFile)) {
         $templateFile = SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'website' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.xml';
     }
     $tags = XMLParser::getXMLdataValues($templateFile);
     // CREATING PREDEFINED RICHTEXT FIELDS
     $richtextCnt = 0;
     $richtextBoxes = array();
     foreach ($tags as $tag) {
         if ($tag['tag'] == 'DESTINATION' && $tag['type'] == 'complete' && $tag['attributes']['TYPE'] == 'richtext') {
             $richtextCnt++;
             $richtextBoxes[$richtextCnt] = $tag['attributes']['ID'];
         }
     }
     $obj = Document::getDocumentInstance($this->getRequestParameter('id'));
     if ($obj) {
         $this->richtext = self::get_richtext($obj->getContent());
     }
     $this->obj = $obj;
     $this->boxes = $richtextBoxes;
 }
예제 #25
0
 public function executeAccountCreate()
 {
     $this->setLayout(false);
     //assign vars
     $folder = Document::getDocumentByExclusiveTag("categories_folder_" . SECTION);
     if ($folder) {
         $cats = Document::getChildrenOf($folder->getId(), "Category");
         foreach ($cats as $cat) {
             $categories[$cat->getId()] = $cat->getlabel();
         }
     }
     $first = array(0 => "all categories");
     $categories = $first + $categories;
     $this->categories = $categories;
     if ($this->media) {
         $this->cv = $this->media;
     } elseif ($this->user && $this->type == "user") {
         $cv_id = $this->user->getCv();
         $cv = Document::getDocumentInstance($cv_id);
         $this->cv = $cv;
         $accpage = Document::getDocumentByExclusiveTag("website_page_account");
         if ($accpage) {
             $this->accountPageUrl = $accpage->getHref(false);
         }
     }
     if ($this->media) {
         $this->logo = $this->media;
     } elseif ($this->user && $this->type == "company") {
         $logo_id = $this->company->getLogo();
         $logo = Document::getDocumentInstance($logo_id);
         $this->logo = $logo;
         $accpage = Document::getDocumentByExclusiveTag("website_page_account");
         if ($accpage) {
             $this->accountPageUrl = $accpage->getHref(false);
         }
     }
     if ($this->getRequestParameter('submitted') == "submitted") {
         $new = false;
         $search = array(",", "/", "\\", "[", "]", "?", "!", "@", "#", "\$", "~", "&", "'", '"', "=", "-", ":", ";", "*", "%", "+", "(", ")", "{", "}", "|", "§", "<", ">", "_", "“", "�?", "„", "`");
         $replace = array("", "", "", "", "", "", "", "", "", "", "", "", " ", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
         $params = $this->getRequest()->getParameterHolder()->getAll();
         foreach ($params as $key => $param) {
             if (!is_array($param)) {
                 ${$key} = trim($param);
             } else {
                 ${$key} = $param;
             }
         }
         if ($this->user) {
             if ($this->user->getLogin() == "admin") {
                 UtilsHelper::setFlashMsg("Admin account cannot be edited in frontend");
                 $this->noform = true;
                 return "Success";
             }
             UtilsHelper::setFlashMsg("Your profile has been successfully updated", UtilsHelper::MSG_SUCCESS);
         } else {
             $new = true;
             $code = md5(time());
             $this->user = new User();
             $this->user->setBackend(0);
             // MAKE SURE NO ACCESS TO ADMIN IS ALLOWED
             $this->user->setActivationCode($code);
         }
         if ($this->type == "company") {
             $this->user->setFirstname($firstname);
             $this->user->setLastname($lastname);
             $this->user->setEmail($email);
             $this->user->setPhone($phone);
             if (!empty($password)) {
                 $this->user->setPassword($password);
             }
         }
         ////////// GET SAVE FOLDERS //////////////
         $userFolders = array();
         $mediaFolders = array();
         $alphaFolder = false;
         $mediaAlphaFolder = false;
         $rootfolderUser = Rootfolder::getRootfolderByModule('user');
         $rootfolderMedia = Rootfolder::getRootfolderByModule('media');
         if ($rootfolderUser) {
             $folders = Document::getChildrenOf($rootfolderUser->getId(), 'Folder');
         }
         if ($rootfolderMedia) {
             $foldersMedia = Document::getChildrenOf($rootfolderMedia->getId(), 'Folder');
         }
         foreach ($folders as $folder) {
             $userFolders[$folder->getLabel()] = $folder->getId();
         }
         foreach ($foldersMedia as $folder) {
             $mediaFolders[$folder->getLabel()] = $folder->getId();
         }
         $title = @str_replace($search, $replace, $firstname);
         $title = trim(@str_replace('  ', ' ', $title));
         $title = mb_strtoupper($title);
         $firstLetter = mb_substr($title, 0, 1);
         if (array_key_exists($firstLetter, $userFolders)) {
             $alphaFolder = Document::getDocumentInstance($userFolders[$firstLetter]);
         }
         if (array_key_exists($firstLetter, $mediaFolders)) {
             $mediaAlphaFolder = Document::getDocumentInstance($mediaFolders[$firstLetter]);
         }
         if (!$alphaFolder) {
             $alphaFolder = new Folder();
             $alphaFolder->setLabel($firstLetter);
             $alphaFolder->save(null, $rootfolderUser);
         }
         if (!$mediaAlphaFolder) {
             $mediaAlphaFolder = new Folder();
             $mediaAlphaFolder->setLabel($firstLetter);
             $mediaAlphaFolder->save(null, $rootfolderMedia);
         }
         ////////////////////////////////////////
         if ($this->type == "user") {
             if ($this->media) {
                 $this->user->setCv($this->media->getId());
             }
             $this->user->setEducation($education);
             $jobtypes = "";
             foreach ($job_types as $jt) {
                 $jobtypes .= "|";
                 $jobtypes .= $jt;
             }
             $this->user->setJobType($jobtypes);
             $saved = $this->user->save(null, $alphaFolder);
         } elseif ($this->type == "company") {
             if (!$this->company) {
                 $this->company = new Company();
             }
             $company_folder = Document::getDocumentByExclusiveTag("company_folder_" . $accountType);
             $this->company->setLabel($label);
             $this->company->setAccountType($accountType);
             $this->company->setDescription($description);
             $this->company->setCountry($country);
             $this->company->setCity($city);
             $this->company->setAddress($address);
             $this->company->setZip($xip);
             $this->company->setWeb($web);
             if ($this->media) {
                 $this->company->setLogo($this->media->getId());
             }
             if ($company_folder) {
                 $this->company->save(null, $company_folder);
             } else {
                 $this->company->save();
             }
             $saved = $this->user->save(null, $this->company);
         }
         if ($this->media) {
             $this->media->save(null, $mediaAlphaFolder);
         }
         if ($saved) {
             if ($new) {
                 $this->user->setPublicationStatus(UtilsHelper::STATUS_WAITING);
                 $confirmMailPage = Document::getDocumentByExclusiveTag('website_page_confirm');
                 if ($confirmMailPage) {
                     $data = array();
                     $data["user"] = $this->user;
                     $data["password"] = $password;
                     $data["comfirmUrl"] = $confirmMailPage->getHref();
                     $data["code"] = $code;
                     $this->getUser()->setAttribute('registrationData', $data);
                     $body = $this->getPresentationFor("user", "registrationMail");
                     try {
                         UtilsHelper::sendEmail($email, $body, "Thank you for registering with Us");
                         UtilsHelper::setFlashMsg("Please check your email to confirm your registration", UtilsHelper::MSG_SUCCESS);
                         $this->noform = true;
                     } catch (Exception $e) {
                         UtilsHelper::setFlashMsg("There was a problem while registering our account, please try again");
                         if ($this->user) {
                             $this->user->delete();
                         }
                         if ($this->company) {
                             $this->company->delete();
                         }
                         if ($this->media) {
                             $this->media->delete();
                         }
                     }
                 }
             }
         }
     }
 }
예제 #26
0
    ?>
	            
	        </div>
	    </div>   
		<div class="sixteen columns">
            <div class="indent-left1 indent-right1">
                <div class="border-bottom"></div>
                <div class="indent-top4">
                    <div class="portfolio-gallery">
                        <div class="fourteen columns">
                            <ul id="gallery">
<?php 
    foreach ($images as $id) {
        ?>
                            <?php 
        if ($img = Document::getDocumentInstance($id)) {
            ?>
                                <li><img src="<?php 
            echo $img->getRelativeUrl();
            ?>
" alt="" /></li>
                            <?php 
        }
    }
    ?>
                            </ul>
                        </div>
                        <a href="#" class="next" id="next"></a>
                        <a href="#" class="prev" id="prev"></a>
                    </div>
                </div>
예제 #27
0
 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");
 }
예제 #28
0
        echo $import->getLabel();
    } else {
        ?>
Ръчно импортирани марки<?php 
    }
    ?>
</td>
						<td><?php 
    if ($import) {
        echo number_format($import->getSize(), 0, '', ' ') . " bytes";
    }
    ?>
 </td>
						<td><?php 
    if ($import) {
        if ($usr = Document::getDocumentInstance($import->getUser())) {
            echo $usr->getLabel();
        } else {
            echo 'Потребител #' . $import->getUser();
        }
    }
    ?>
</td>
						<td><?php 
    echo $is->getStartId();
    ?>
</td>
						<td><?php 
    echo $is->getTmCount();
    ?>
</td>
예제 #29
0
파일: listSuccess.php 프로젝트: kotow/work
    ?>
		<div class="news">
			<h2><?php 
    echo $n->getLabel();
    ?>
</h2>
			<?php 
    echo UtilsHelper::Date($n->getStartDate(), "H:i | d.m.Y");
    ?>
 | Прочетена: <strong><?php 
    echo $n->getRds();
    ?>
 пъти</strong>
			<?php 
    $img = $n->getImage();
    if ($image = Document::getDocumentInstance($img)) {
        ?>
				<img width="528" src="/media/upload/<?php 
        echo $img;
        ?>
" class="news_im" title="<?php 
        echo $image->getDescription();
        ?>
"/>
			<?php 
    }
    ?>
			<p><?php 
    echo $n->getShortDescription();
    ?>
</p>
예제 #30
0
 public static function objectEdit($moduleName, $documentName, &$act, $id = null)
 {
     $act->setLayout("iframe");
     if ($act->getRequestParameter('id') && is_null($id)) {
         $id = $act->getRequestParameter('id');
     }
     if ($id) {
         $act->obj = Document::getDocumentInstance($id);
     }
     $act->tags = Document::getAvailableTagsOf($act->getRequestParameter('module'), $documentName);
     if ($documentName == "Folder" || $documentName == "Tag") {
         $act->moduleName = $act->getUser()->getAttribute('currentModule');
     } else {
         $act->moduleName = $moduleName;
     }
     $act->documentName = $documentName;
     //		$act->editAction = $moduleName."/edit".$documentName.'/id/'.$id;
     if (!in_array('executeSave' . $documentName, get_class_methods($moduleName . 'Actions'))) {
         $act->formAction = "/admin/admin/save";
     } else {
         $act->formAction = "/admin/" . $moduleName . "/save" . $documentName;
     }
 }