Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 /**
  * Edit the cms fields in the CMS
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', DateField::create('DatePublished', 'Enter a published date')->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('dmyseparator', ' ')->setConfig('showcalendar', true));
     $fields->addFieldToTab('Root.Main', $uploadField = new UploadField($name = 'ArticleSummaryImage', $title = 'Upload an article summary image'));
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('Summary', 'Summary'));
     $location = new TextField('Location', 'Location');
     $fields->addFieldToTab('Root.Main', $location);
     $tagfield = TagField::create('EventTags', 'Event Tags', EventTag::get(), $this->EventTags())->setShouldLazyLoad(true)->setCanCreate(true);
     $fields->addFieldToTab('Root.Main', $tagfield);
     return $fields;
 }
Exemplo n.º 3
0
 public function addEventTag(EventTag $l)
 {
     $this->collEventTags[] = $l;
     $l->setEvent($this);
 }