See also: XML
Author: Zurab Davitiani
示例#1
0
 /**
  * @return void
  */
 protected function upgradeTo02()
 {
     // Add Tag-column
     /* @var CDbCommand $cmd */
     $cmd = Yii::app()->db->createCommand();
     $cmd->addColumn('Tag', 'userId', 'integer NOT NULL');
     $cmd->addForeignKey('user', 'Tag', 'userId', 'User', 'id', 'CASCADE', 'CASCADE');
     // Refresh DB-Schema
     Yii::app()->db->schema->refresh();
     Tag::model()->refreshMetaData();
     // Set user-IDs
     foreach (Tag::model()->findAll() as $model) {
         // Collect User-IDs
         $userIds = array();
         foreach ($model->entries as $entry) {
             $userIds[$entry->userId] = $entry->userId;
         }
         // Save tag with user relation
         foreach ($userIds as $userId) {
             $tag = new Tag();
             $tag->name = $model->name;
             $tag->userId = $userId;
             $tag->save(false);
         }
         // Remove tag
         $model->delete();
     }
 }
示例#2
0
 public static function recordTags($phrase, $model, $obj)
 {
     $tags = TagTools::splitPhrase($phrase);
     foreach ($tags as $settag) {
         $tag = new Tag();
         if ($model == "etime") {
             $modelTag = new EtimeTag();
         } else {
             $modelTag = new EventTag();
         }
         $tag->setTag($settag);
         $c = new Criteria();
         $c->add(TagPeer::NORMALIZED_TAG, $tag->getNormalizedTag());
         $tag_exists = TagPeer::doSelectOne($c);
         if (!$tag_exists) {
             $tag->save();
         } else {
             $tag = $tag_exists;
         }
         if ($model == "etime") {
             $modelTag->setEtime($obj);
         } else {
             $modelTag->setEvent($obj);
         }
         $modelTag->setTag($tag);
         $modelTag->save();
     }
     return true;
 }
示例#3
0
文件: Photo.php 项目: freyr/gallery
 /**
  * @param array $tags
  */
 public function setTags(array $tags)
 {
     foreach ($tags as $tag) {
         $tag = new Tag($tag);
         $this->tags[$tag->getName()] = $tag;
     }
 }
示例#4
0
 /**
  * @param sfGuardUser $user
  * @param integer $element_id
  * @param string $name
  * @param string $type
  */
 public static function newTag($user, $element_id, $name, $type)
 {
     $tag = TagTable::getInstance()->findOneByNameAndUserId($name, $user->id);
     if (!$tag) {
         $tag = new Tag();
         $tag->setName(substr($name, 0, self::MAX_LENGTH));
         $tag->setUserId($user->id);
         $tag->save();
     }
     if ($type == 'decision') {
         $tagDecision = new TagDecision();
         $tagDecision->setDecisionId($element_id);
         $tagDecision->setTagId($tag->id);
         $tagDecision->save();
     } else {
         if ($type == 'release') {
             $tagRelease = new TagRelease();
             $tagRelease->setReleaseId($element_id);
             $tagRelease->setTagId($tag->id);
             $tagRelease->save();
         } else {
             $tagAlternative = new TagAlternative();
             $tagAlternative->setAlternativeId($element_id);
             $tagAlternative->setTagId($tag->id);
             $tagAlternative->save();
             Doctrine_Query::create()->delete('Graph')->where('decision_id = ?', $tagAlternative->Alternative->decision_id)->execute();
         }
     }
     return;
 }
示例#5
0
文件: Model.php 项目: peacq/picorm
 public static function createAndSaveRawModelWithManyToManyRelation()
 {
     include_once __DIR__ . '/../scripts/tested_models.php';
     $car = new \Car();
     $car->nameCar = 'AcmeCar';
     $car->noteCar = '10';
     $car->idBrand = 1;
     $car->save();
     $tags = array();
     $tag1 = new \Tag();
     $tag1->libTag = 'Sport';
     $tag1->save();
     $tag2 = new \Tag();
     $tag2->libTag = 'Family';
     $tag2->save();
     $tag3 = new \Tag();
     $tag3->libTag = 'Crossover';
     $tag3->save();
     $tags[] = $tag1;
     $tags[] = $tag2;
     $tags[] = $tag3;
     $car->setTag($tags);
     $car->save();
     // create test
     $req = \PicORM\Model::getDataSource()->prepare('SELECT count(*) as nb FROM car_have_tag WHERE idCar = ?');
     $req->execute(array($car->idCar));
     $resultBDD = $req->fetch(\PDO::FETCH_ASSOC);
     return array(array($car, $tags, $resultBDD));
 }
示例#6
0
 public static function savePostTags($postid, $tags)
 {
     $postid = (int) $postid;
     if (0 === $postid || empty($tags)) {
         return false;
     }
     if (is_string($tags)) {
         $tags = self::filterTagsArray($tags);
     }
     $count = 0;
     foreach ((array) $tags as $v) {
         $model = self::model()->findByAttributes(array('name' => $v));
         if ($model === null) {
             $model = new Tag();
             $model->name = $v;
             if ($model->save()) {
                 $count++;
             }
         }
         $row = app()->getDb()->createCommand()->select('id')->from(TABLE_POST_TAG)->where(array('and', 'post_id = :postid', 'tag_id = :tagid'), array(':postid' => $postid, ':tagid' => $model->id))->queryScalar();
         if ($row === false) {
             $columns = array('post_id' => $postid, 'tag_id' => $model->id);
             $count = app()->getDb()->createCommand()->insert(TABLE_POST_TAG, $columns);
             if ($count > 0) {
                 $model->post_nums = $model->post_nums + 1;
                 $model->save(true, array('post_nums'));
             }
         }
         unset($model);
     }
     return $count;
 }
示例#7
0
    public function afterSave()
    {
        $this->_deleteRels();

        $model_id = get_class($this->owner);

        if (isset($_POST[$model_id]['tags']))
        {
            foreach (explode(',', $_POST[$model_id]['tags']) as $tag_name)
            {
                $tag = Tag::model()->find("name = '{$tag_name}'");
                if (!$tag)
                {
                    $tag = new Tag();
                    $tag->name = $tag_name;
                    $tag->save();
                }

                $tag_rel = new TagRel();
                $tag_rel->tag_id    = $tag->id;
                $tag_rel->object_id = $this->owner->id;
                $tag_rel->model_id  = $model_id;
            }
        }
    }
示例#8
0
 /**
  * The function returns JSON responses for different methods.
  * 
  * @access public
  * @param string $method THe method.
  * @return string The JSON response.
  */
 public function json($method = null)
 {
     $response = array();
     switch ($method) {
         case 'tags':
             $Tag = new Tag();
             $params = array();
             $params[] = $Tag->getParam('search', Request::get('term'));
             foreach ($Tag->findList($params, 'Name asc', 0, 20) as $Tag) {
                 $response[] = $Tag->Name;
             }
             break;
         case 'ref':
             $Object = null;
             $params = array();
             if (Request::get('field') == 'Reference[Page]') {
                 $Object = new Content_Page();
             } else {
                 if (Request::get('field') == 'Reference[Product]') {
                     $Object = new Product();
                 }
             }
             if ($Object) {
                 $params[] = $Object->getParam('search', Request::get('term'));
                 foreach ($Object->findShortList($params, 'Name asc', 0, 10) as $Object) {
                     printf("%d|%s\n", $Object->Id, $Object->Name);
                 }
             }
             exit;
             break;
     }
     return $this->outputJSON($response);
 }
示例#9
0
文件: Tag.php 项目: kzfk/emlauncher
 public static function insertNewTag($app_id, $name, PDO $con = null)
 {
     $row = array('app_id' => $app_id, 'name' => $name);
     $tag = new Tag($row);
     $tag->insert($con);
     return $tag;
 }
 /**
  * Set the options available for this input.
  *
  * @param array[] $options Array of menu options in the format
  *   `array( 'data' => …, 'label' => … )`
  * @chainable
  */
 public function setOptions($options)
 {
     $value = $this->getValue();
     $isValueAvailable = false;
     $this->options = array();
     // Rebuild the dropdown menu
     $this->input->clearContent();
     foreach ($options as $opt) {
         $optValue = $this->cleanUpValue($opt['data']);
         $option = new Tag('option');
         $option->setAttributes(array('value' => $optValue));
         $option->appendContent(isset($opt['label']) ? $opt['label'] : $optValue);
         if ($value === $optValue) {
             $isValueAvailable = true;
         }
         $this->options[] = $option;
         $this->input->appendContent($option);
     }
     // Restore the previous value, or reset to something sensible
     if ($isValueAvailable) {
         // Previous value is still available
         $this->setValue($value);
     } else {
         // No longer valid, reset
         if (count($options)) {
             $this->setValue($options[0]['data']);
         }
     }
     return $this;
 }
示例#11
0
 public function viewAction()
 {
     $label = $this->_getParam('label');
     if ($label === null) {
         throw new Zend_Exception('No label specified in TagsController::viewAction()');
     }
     $tagManager = new Tag();
     $tag = $tagManager->fetchRow(array('label = ?' => $label));
     if ($tag === null) {
         throw new Zend_Exception('Tag not found in TagsController::viewAction()');
     }
     $this->view->tag = $tag;
     // get posts
     $page = array_key_exists('p', $_GET) ? $_GET['p'] : 1;
     $page = $page < 1 ? 1 : $page;
     $this->view->page = $page;
     $postManager = new Post();
     $postCount = $postManager->fetchAll(array('id IN (SELECT post_id FROM posts_tags WHERE tag_id = ?)' => $tag->id, 'is_active = ?' => 1))->count();
     $this->view->pageCount = ceil($postCount / 10);
     $this->view->posts = $postManager->fetchAll(array('id IN (SELECT post_id FROM posts_tags WHERE tag_id = ?)' => $tag->id, 'is_active = ?' => 1), 'posted_at DESC', 10, ($page - 1) * 10);
     $this->view->paginationBase = '/tags/' . $tag->label;
     // description
     $this->view->metaDescription = 'Read my posts tagged with \'' . $tag->title . '\'.';
     // set title
     $this->_title('Posts tagged with \'' . $tag->title . '\'');
     $this->_forward('listing', 'posts');
 }
示例#12
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $user_id = Auth::id();
     $comment = Input::get('comment');
     $tags = Input::get('tagged_uid');
     $rating = Input::get('rating');
     $type = Input::get('media_type');
     $imdb_id = Input::get('imdb_id');
     $post = new Post();
     $post->user_id = $user_id;
     $post->type = $type;
     $post->imdb_id = $imdb_id;
     $post->rating = $rating;
     $post->comment = $comment;
     $post->save();
     if (sizeof($tags) > 0) {
         foreach ($tags as $tagged_uid) {
             $tag = new Tag();
             $tag->post_id = $post->id;
             $tag->user_tagging = $user_id;
             $tag->user_tagged = $tagged_uid;
             $tag->save();
         }
     }
     return Redirect::to('/media/' . $imdb_id);
 }
示例#13
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;
 }
示例#14
0
文件: post.php 项目: xfra35/fabulog
 /**
  * set and add new tags to the post entity
  * @param string $val
  * @return array
  */
 public function set_tags($val)
 {
     if (!empty($val)) {
         $tagsArr = \Base::instance()->split($val);
         $tag_res = new Tag();
         $tags = array();
         // find IDs of known Tags
         $known_tags = $tag_res->find(array('title IN ?', $tagsArr));
         if ($known_tags) {
             foreach ($known_tags as $tag) {
                 $tags[$tag->_id] = $tag->title;
             }
             $newTags = array_diff($tagsArr, array_values($tags));
         } else {
             $newTags = $tagsArr;
         }
         // create remaining new Tags
         foreach ($newTags as $tag) {
             $tag_res->reset();
             $tag_res->title = $tag;
             $out = $tag_res->save();
             $tags[$out->_id] = $out->title;
         }
         // set array of IDs to current Post
         $val = array_keys($tags);
     }
     return $val;
 }
示例#15
0
 function cmpTags(Tag $a, Tag $b)
 {
     if ($a->SizeRelatedContext() == $b->SizeRelatedContent()) {
         return 0;
     }
     return $a->SizeRelatedContent() < $b->SizeRelatedContent() ? -1 : 1;
 }
示例#16
0
 public static function add($id, $meta)
 {
     $desc = Description::create(['id' => $id, 'name' => $meta->name, 'market_name' => $meta->market_name ?: $meta->name, 'icon_url' => $meta->icon_url, 'icon_url_large' => isset($meta->icon_url_large) ? $meta->icon_url_large : '', 'name_color' => $meta->name_color ?: '000000']);
     if (!empty($meta->actions)) {
         foreach ($meta->actions as $idx => $action) {
             if ($action->name == 'Inspect in Game...') {
                 $desc->inspect_url_template = $action->link;
                 $desc->save();
                 break;
             }
         }
     }
     foreach ($meta->tags as $idx => $tag_data) {
         $tag = Tag::find('all', array('conditions' => array('category = ? AND category_name = ? AND internal_name = ? AND name = ?', $tag_data->category, $tag_data->category_name, $tag_data->internal_name, $tag_data->name)));
         if (empty($tag)) {
             $tag = new Tag(['category' => $tag_data->category, 'category_name' => $tag_data->category_name, 'internal_name' => $tag_data->internal_name, 'name' => $tag_data->name]);
             if (!$tag->is_valid()) {
                 $desc->delete();
                 return null;
             } else {
                 $tag->save();
             }
         } else {
             $tag = $tag[0];
         }
         if ($tag_data->category == 'Rarity') {
             $desc->name_color = $tag_data->color;
             $desc->save();
         }
         Descriptiontag::create(['description_id' => $desc->id, 'tag_id' => $tag->id]);
     }
     return $desc;
 }
示例#17
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'method':
             // alias
         // alias
         case 'operation':
             $method = strtolower(self::words_shift($data));
             if (!in_array($method, self::$methods)) {
                 throw new \SwaggerGen\Exception("Unrecognized operation method '{$method}'.");
             }
             if (isset($this->operations[$method])) {
                 $Operation = $this->operations[$method];
             } else {
                 $summary = $data;
                 $Operation = new Operation($this, $summary, $this->tag);
                 $this->operations[$method] = $Operation;
             }
             return $Operation;
         case 'description':
             if ($this->tag) {
                 return $this->tag->handleCommand($command, $data);
             }
             break;
     }
     return parent::handleCommand($command, $data);
 }
示例#18
0
 public function cascadeInvalidationTo(Tag $tag)
 {
     $this->cascade[] = $tag;
     if ($this->invalid) {
         $tag->invalidate();
     }
 }
示例#19
0
function XML_Read($Object, $Level = 1)
{
    #-----------------------------------------------------------------------------
    static $Index = 1;
    #-----------------------------------------------------------------------------
    $Md5 = Md5($Index++);
    #-----------------------------------------------------------------------------
    $Attribs = $Object->Attribs;
    #-----------------------------------------------------------------------------
    $Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name;
    #-----------------------------------------------------------------------------
    $P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name));
    #-----------------------------------------------------------------------------
    $Node = new Tag('DIV', array('class' => 'Node'), $P);
    #-----------------------------------------------------------------------------
    if (Count($Attribs)) {
        #---------------------------------------------------------------------------
        foreach (Array_Keys($Attribs) as $AttribID) {
            $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID])));
        }
    }
    #-----------------------------------------------------------------------------
    if (Count($Childs = $Object->Childs)) {
        #---------------------------------------------------------------------------
        $Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5));
        #---------------------------------------------------------------------------
        foreach ($Childs as $Child) {
            $Content->AddChild(XML_Read($Child, $Level + 1));
        }
        #---------------------------------------------------------------------------
        $Node->AddChild($Content);
    }
    #-----------------------------------------------------------------------------
    return $Node;
}
示例#20
0
 /**
  * This function will create a new user object and return the newly created user object.
  *
  * @param array $userInfo This should have the properties: username, firstname, lastname, password, ui_language
  *
  * @return mixed
  */
 public function registerUser(array $userInfo, $userLanguage)
 {
     $user = \User::create($userInfo);
     //make the first user an admin
     if (\User::all()->count() <= 1) {
         $user->is_admin = 1;
     }
     // Trim trailing whitespace from user first and last name.
     $user->firstname = trim($user->firstname);
     $user->lastname = trim($user->lastname);
     $user->save();
     \Setting::create(['ui_language' => $userLanguage, 'user_id' => $user->id]);
     /* Add welcome note to user - create notebook, tag and note */
     //$notebookCreate = Notebook::create(array('title' => Lang::get('notebooks.welcome_notebook_title')));
     $notebookCreate = new \Notebook();
     $notebookCreate->title = Lang::get('notebooks.welcome_notebook_title');
     $notebookCreate->save();
     $notebookCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
     //$tagCreate = Tag::create(array('title' => Lang::get('notebooks.welcome_note_tag'), 'visibility' => 0));
     $tagCreate = new \Tag();
     $tagCreate->title = Lang::get('notebooks.welcome_note_tag');
     $tagCreate->visibility = 0;
     $tagCreate->user_id = $user->id;
     $tagCreate->save();
     //$tagCreate->users()->attach($user->id);
     $noteCreate = new \Note();
     $versionCreate = new \Version(['title' => Lang::get('notebooks.welcome_note_title'), 'content' => Lang::get('notebooks.welcome_note_content'), 'content_preview' => mb_substr(strip_tags(Lang::get('notebooks.welcome_note_content')), 0, 255), 'user_id' => $user->id]);
     $versionCreate->save();
     $noteCreate->version()->associate($versionCreate);
     $noteCreate->notebook_id = $notebookCreate->id;
     $noteCreate->save();
     $noteCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
     $noteCreate->tags()->sync([$tagCreate->id]);
     return $user;
 }
示例#21
0
 public function setTagsArray(array $data)
 {
     // reset dei tag per semplificare lo script
     ProductTag::model()->deleteAll('product=:p', array(':p' => $this->id));
     // data attuale
     $now = new DateTime();
     $timestamp = $now->format('Y-m-d H-i-s');
     // ricerca dei tag e creazione dei link
     foreach ($data as $tagName) {
         $tag = Tag::model()->find('name=:nm', array(':nm' => $tagName));
         /** @var Tag $tag */
         if ($tag == null) {
             $tag = new Tag();
             $tag->name = $tagName;
             $tag->description = ucwords($tagName);
             $tag->timestamp = $timestamp;
             $tag->insert();
         }
         $productTag = ProductTag::model()->find('product=:p AND tag=:t', array(':p' => $this->id, ':t' => $tag->id));
         /** @var ProductTag $productTag */
         if ($productTag == null) {
             $productTag = new ProductTag();
             $productTag->product = $this->id;
             $productTag->tag = $tag->id;
             $productTag->insert();
         }
     }
 }
示例#22
0
 public function controlerJob($maincont)
 {
     if ($maincont->isLoggued()) {
         if (isset($_POST["title"])) {
             $p = new Post();
             $p->setTitle($_POST["title"]);
             $p->setBody($_POST["body"]);
             $p->setHour(date("h:i:s"));
             $p->setDate(date("Y-m-d"));
             // gestion des tags
             $tags = explode(" ", $_POST["tags"]);
             foreach ($tags as $t) {
                 if ($t == "") {
                     continue;
                 }
                 $ta = Tag::getByTag($t);
                 //echo "Tag : $t<br />";
                 if (count($ta) == 0) {
                     $mytag = new Tag();
                     $mytag->setTag($t);
                 } else {
                     $mytag = $ta[0];
                 }
                 // création du posttag liant le tag et le post
                 $pt = new Posttag();
                 $pt->setPostid($p->id);
                 $pt->setTagid($mytag->id);
             }
         }
         $maincont->goModule("post", "admin");
     } else {
         $maincont->goModule("home", "display");
     }
 }
 /**
  * Prepare sidebar data, random tags and archive list
  */
 private function prepareSidebar()
 {
     //if tags cache exist, skip retrieving from DB, expires every 5 minutes
     $cacheTagOK = Doo::cache('front')->testPart('sidebarTag', 300);
     if (!$cacheTagOK) {
         echo '<h2>Cache expired. Get Tags from DB!</h2>';
         //get random 10 tags
         Doo::loadModel('Tag');
         $tags = new Tag();
         $this->data['randomTags'] = $tags->limit(10, null, null, array('custom' => 'ORDER BY RAND()'));
     } else {
         $this->data['randomTags'] = array();
     }
     //if archive cache exist, skip retrieving from DB, archive expires when Post added, updated, deleted
     $cacheArchiveOK = Doo::cache('front')->testPart('sidebarArchive', 31536000);
     if (!$cacheArchiveOK) {
         echo '<h2>Cache expired. Get Archives from DB!</h2>';
         //you can pass data to constructor to set the Model properties
         Doo::loadModel('Post');
         $p = new Post(array('status' => 1));
         $this->data['archives'] = $p->getArchiveSummary();
     } else {
         $this->data['archives'] = array();
     }
 }
示例#24
0
文件: Tag.php 项目: Sywooch/noteapp
 /**
  * @param String $tag
  * @return Tag
  */
 public function createNew($tag)
 {
     $tagInstance = new Tag();
     $tagInstance->name = $tag;
     $tagInstance->save();
     return $tagInstance;
 }
 protected function getInputElement($config)
 {
     $type = in_array($config['type'], array('button', 'submit', 'reset')) ? $config['type'] : 'button';
     $input = new Tag($config['useInputTag'] ? 'input' : 'button');
     $input->setAttributes(array('type' => $type));
     return $input;
 }
示例#26
0
 /**
  * Event method sharing the contacts with the Co-Workers
  * @param object $evtcl
  */
 function eventShareContactsMultiple(EventControler $evtcl)
 {
     $contacts = $evtcl->getParam("idcontacts");
     $co_workers = $evtcl->getParam("cwid");
     $count = 0;
     $no_coworker = 0;
     if (is_array($contacts) && is_array($co_workers)) {
         $do_tag = new Tag();
         foreach ($co_workers as $co) {
             foreach ($contacts as $cont) {
                 if (!$this->checkCoWorkerContactRel($cont, $co)) {
                     $this->addContactSharings($cont, $co);
                     $do_tag->addTagOnContactSharing($cont, $co);
                     $count++;
                 }
             }
         }
     }
     if ($count) {
         $msg = 'Sharing Updated succesfully';
     } else {
         $msg = 'No Data updated,you may be trying to duplicate some contact access';
     }
     $goto = $evtcl->goto;
     $dispError = new Display($goto);
     $dispError->addParam("message", $msg);
     $evtcl->setDisplayNext($dispError);
 }
示例#27
0
 private function treeProcessBottom(Tree &$tree, Tag &$tag)
 {
     $ul = new Ul();
     $isRoot = $tree->key == 'GN';
     $isRootChild = $tree->parentKey == 'GN';
     if (!$isRoot) {
         $currentLi = $this->bottomTreeRender($tree, $isRootChild ? "is_root" : "");
         if ($isRootChild) {
         }
         $tag->addChild($currentLi);
     }
     if (count($tree->childrens) != 0) {
         if (!$isRoot) {
             $currentLi->addChild($ul);
         } else {
             $tag->addChild($ul);
         }
         $ul->addStyleClasses(array("container", "text_bottom_tree"));
         $this->treeLevel++;
         foreach ($tree->childrens as $treeChild) {
             $this->treeProcessBottom($treeChild, $ul);
         }
         $this->treeLevel--;
     }
 }
示例#28
0
 public function renderTagHead(Tag $tag)
 {
     $res = '## [' . $tag->getName() . ']';
     if ($tag->getDate()) {
         $res .= ' - ' . $tag->getDate();
     }
     return $res . "\n";
 }
示例#29
0
 public function render()
 {
     if ($this->legend) {
         $legend = new Tag('legend', $this->legend);
         $this->prepend($legend->render());
     }
     return parent::render();
 }
示例#30
0
function tag()
{
    for ($i = 0; $i < 100000; $i++) {
        $tag = new Tag();
        $tag->Name = getRandStr(mt_rand(2, 5));
        $tag->Save();
    }
}