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


PHP Document::hasTag方法代码示例

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


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

示例1: executeMainNav

 public function executeMainNav()
 {
     $this->setLayout(false);
     $menuItems = array();
     if ($menu = Document::getDocumentByExclusiveTag("website_menu_main")) {
         $topics = Document::getChildrenOf($menu->getId(), 'Topic');
         foreach ($topics as $t) {
             $pages = Document::getChildrenOf($t->getId(), 'Page');
             foreach ($pages as $p) {
                 if (Document::hasTag($p, 'website_page_index')) {
                     $menuItems[$t->getId()] = $p;
                     break;
                 }
             }
         }
     }
     $this->menuItems = $menuItems;
 }
开发者ID:kotow,项目名称:work,代码行数:18,代码来源:actions.class.php

示例2: foreach

<div class="indent-top2">
	<div class="content">
		<div style="text-align:center;" class="indent-top1 indent-bottom1">
<?php 
$i = 0;
foreach ($services as $p) {
    if (Document::hasTag($p, "website_page_index")) {
        continue;
    }
    $page = Document::getDocumentByCulture($p, null, true);
    $url = $page->getHref();
    ?>
		<div class="one-third column omega <?php 
    if ($i % 3 != 2) {
        echo 'indent-right5';
    }
    ?>
"  style="height: 350px;">
			<div class="indent-left1 indent-top2 indent-right1">
				<h2><?php 
    echo strip_tags($page->getDescription(), '<br>,<br/>');
    ?>
</h2>
				<a href="<?php 
    echo $url;
    ?>
">
					<img src="/media/display/thumb/thumbs/id/<?php 
    echo $page->getImage();
    ?>
" alt="">
开发者ID:kotow,项目名称:work,代码行数:31,代码来源:servicesListSuccess.php

示例3: backend_tags

function backend_tags($tags, $obj)
{
    $count = count($tags);
    if ($count) {
        $width = intval(100 / $count) - 1;
    }
    if ($count > 4) {
        $width = 19;
    }
    if ($count) {
        $widthStr = 'width="' . $width . '%"';
    }
    if ($count > 0) {
        $code = "<h3>Tags</h3>\n\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    }
    $ind = 0;
    foreach ($tags as $tag) {
        if ($ind % 5 == 0) {
            $code .= "\t<tr>\n";
            $closed = false;
        }
        $code .= "\t\t<td>\n" . "\t\t\t" . backend_checkbox('tag_id_' . $tag->getId(), Document::hasTag($obj, $tag->getTagId()), array("class" => "check_box", "labelname" => "")) . "\n" . "\t\t</td>\n" . "\t\t<td " . $widthStr . " class=\"label_checkbox\">" . getLabelName($options['labelname'], $tag->getLabel()) . "</td>\n";
        if ($ind % 5 == 4) {
            $code .= "\t</tr>\n";
            $closed = true;
        }
        $ind++;
    }
    if ($count > 0) {
        if (!$closed) {
            $code .= "\t</tr>\n";
        }
        $code .= "</table>";
    }
    return $code;
}
开发者ID:kotow,项目名称:work,代码行数:36,代码来源:BackendFormHelper.php

示例4: getSiteMap

 public static function getSiteMap($root = null, &$sitemap, $depth = 1000, $level = 1, $path = null, $getIndex = false, $getInvisible = false)
 {
     if ($level > $depth) {
         return array();
     }
     $nolabel = UtilsHelper::Localize("website.frontend.nolabel");
     if (!$root) {
         $root = Rootfolder::getRootfolderByModule("website");
         if (!$root) {
             return;
         }
     }
     if (is_object($root)) {
         $root = $root->getId();
     }
     $pathSet = false;
     if (Document::hasChildren($root)) {
         //			$oldRelationsFlag = sfConfig::get('sf_cache_relations');
         //			sfConfig::set('sf_cache_relations', false);
         try {
             $children = Document::getChildrenOf($root, null, true, false);
             foreach ($children as $child) {
                 // skip  Urlrewrite objects
                 if (get_class($child) == "Urlrewrite" || get_class($child) == "Media") {
                     continue;
                 }
                 $href = "";
                 $label = $nolabel;
                 $childId = $child->getId();
                 $class = get_class($child);
                 $showItem = true;
                 if (Document::getStatus($child) != UtilsHelper::STATUS_ACTIVE) {
                     continue;
                 }
                 if (!$getIndex && Document::hasTag($child, "website_page_index")) {
                     continue;
                 }
                 if (!$getInvisible) {
                     if ($class == 'Page' && Document::hasTag($child, "website_page_nonvisible") || $class == 'Topic' && Document::hasTag($child, "website_topic_nonvisible")) {
                         $id = $childId;
                         $showItem = false;
                         //continue;
                     }
                 }
                 if ($showItem) {
                     if ($class == "Page") {
                         $type = $child->getPageType();
                         $secure = $child->getIsSecure();
                         //$label = $child->getLabel();
                         $label = $child->getNavigationTitle();
                         $href = $child->getHref();
                         $id = $childId;
                     } elseif ($class == "Topic") {
                         $label .= $child->getLabel();
                         // " (".$child->getLabel().")";
                         $indexPage = $child->getIndexPage();
                         $id = 0;
                         if ($indexPage) {
                             //$id = $indexPage->getId();
                             $id = $childId;
                             $href = $indexPage->getHref();
                             $label = $indexPage->getLabel();
                             $type = $indexPage->getPageType();
                             //									if ($type == "REFERENCE")
                             //									{
                             //										//echo "--- Topic: ".$id." ---\n";
                             //										$pg = Document::getDocumentByCulture($indexPage->getPageId(), null, true); // get PageI18n object
                             //										if($pg)
                             //										{
                             //											$id = $pg->getId();
                             //											$href = $pg->getHref();
                             //											$secure = $pg->getIsSecure();
                             //										}
                             //									}
                         }
                     } else {
                         $id = $childId;
                         $label = $child->getLabel();
                     }
                 }
                 if ($id && !$pathSet) {
                     $path[] = $id;
                     $pathSet = true;
                 } else {
                     $c = count($path);
                     $path[$c - 1] = $id;
                 }
                 $sitemap[$root][$childId]['path'] = $path;
                 $sitemap[$root][$childId]['id'] = $id;
                 $sitemap[$root][$childId]['href'] = $href;
                 $sitemap[$root][$childId]['label'] = $label;
                 if (array_key_exists('secure', $sitemap[$root][$childId])) {
                     $sitemap[$root][$childId]['secure'] = $secure;
                 }
                 $sitemap[$root][$childId]['level'] = $level;
                 $sitemap[$root][$childId]['model'] = $class;
                 $sitemap[$root][$childId]['show'] = $showItem;
                 self::getSiteMap($child->getId(), $sitemap, $depth, $level + 1, $path, $getIndex, $getInvisible);
             }
         } catch (Exception $e) {
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:MenuHelper.php

示例5: frontend_tags

function frontend_tags($tags, $obj)
{
    if (count($tags) > 0) {
        $code = "<h3>Tags</h3>";
    }
    foreach ($tags as $tag) {
        $code .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n" . "\t<tr>\n" . "\t\t<td>\n" . "\t\t\t" . frontend_checkbox('tag_id_' . $tag->getId(), Document::hasTag($obj, $tag->getTagId()), array("class" => "check_box", "labelname" => "")) . "\n" . "\t\t</td>\n" . "\t\t<td class=\"label_checkbox\">" . getLabelName($options['labelname'], $tag->getLabel()) . "</td>\n" . "\t</tr>" . "</table>";
    }
    return $code;
}
开发者ID:kotow,项目名称:work,代码行数:10,代码来源:FrontendFormHelper.php

示例6: panel_tags

function panel_tags($tags, $obj, $id = null)
{
    if ($id) {
        $obj = Document::getDocumentInstance($id);
    }
    //	if(substr(get_class($obj),-4) == "I18n") $obj = Document::getParentOf($obj->getId());
    $count = count($tags);
    $user = sfContext::getInstance()->getUser()->getSubscriber();
    if ($count == 0 || $user && $user->getType() != "admin") {
        return;
    }
    if ($count) {
        $width = intval(100 / $count) - 1;
    }
    if ($count > 4) {
        $width = 16;
    }
    if ($count) {
        $widthStr = 'width="' . $width . '%"';
    }
    if ($count > 0) {
        $code = "<h3>Tags</h3>\n\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    }
    $ind = 0;
    foreach ($tags as $tag) {
        if ($ind % 6 == 0) {
            $code .= "\t<tr>\n";
            $closed = false;
        }
        $code .= "\t\t<td width='20'>\n" . "\t\t\t" . panel_checkbox('tag_id_' . $tag->getId(), Document::hasTag($obj, $tag->getTagId()), array('class' => 'check_box', 'labelname' => '', 'no_wrapper' => 1)) . "\n" . "\t\t</td>\n" . "\t\t<td " . $widthStr . " class=\"label_checkbox\">" . $tag->getLabel() . "</td>\n";
        if ($ind % 6 == 5) {
            $code .= "\t</tr>\n";
            $closed = true;
        }
        $ind++;
    }
    if ($count > 0) {
        if (!$closed) {
            $code .= "\t</tr>\n";
        }
        $code .= "</table>";
    }
    return $code;
}
开发者ID:kotow,项目名称:work,代码行数:44,代码来源:PanelFormHelper.php


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