protected function makeOption($value, $content, $name)
 {
     $option = DOMFactory::getOption($value)->addContent($content);
     if ($this->request->valueOf($name) == $value) {
         $option->addSelected(true);
     }
     return $option;
 }
 private function getYears()
 {
     $years = DOMFactory::getSelect()->addName('year')->addId('year')->addClass('regDateYears');
     $options = $this->makeOption('', 'Year', 'year');
     for ($i = 2000; $i > 2000 - 80; $i--) {
         $options .= $this->makeOption($i, $i, 'year');
     }
     $years->addContent($options);
     return $years;
 }
 protected function find()
 {
     $this->template->formAction = $this->url->getActionURL(__FUNCTION__);
     if ($this->request->error) {
         $this->template->message = DOMFactory::getDiv($this->request->error)->addClass('error');
     }
     $this->template->name = $this->values->name;
     $this->template->show($this->url->getActionPath());
     $this->wall();
 }
 public function generateSelectGender()
 {
     $labels = array('Gender', 'Kobieta', 'Mężczyzna');
     $genders = DOMFactory::getSelect()->addName('gender');
     $options = '';
     for ($i = 0; $i < 3; $i++) {
         $options .= $this->makeOption($i, $labels[$i], 'gender');
     }
     $genders->addContent($options);
     return $genders;
 }
 private function prepareRequest()
 {
     if ($this->request->error) {
         foreach ($this->request->getValues() as $key => $value) {
             $this->template->{$key} = $value;
         }
         $this->template->message = DOMFactory::getDiv($this->request->error)->addClass('error');
     }
     if ($this->request->success) {
         $this->template->message = DOMFactory::getDiv($this->request->success)->addClass('success');
     }
 }
 private function makeComment($comment)
 {
     $avatar = $this->prepareAvatar($comment->getUser());
     $author = DOMFactory::getDiv($avatar)->addId('comment-avatar');
     $link = $this->url->getCustomActionURL('profile', $comment->getLogin());
     $nameLink = DOMFactory::getLink($link, $comment->getName());
     $content = DOMFactory::getDiv($nameLink)->addClass('name');
     $content .= DOMFactory::getDiv($comment->getContent());
     $content .= DOMFactory::getDiv('Added on: ' . Date::convert($comment->getDate(), 'j F Y'))->addClass('date');
     $author .= DOMFactory::getDiv($content)->addId('comment-author');
     $section = DOMFactory::getDiv($author)->addId('comment');
     $section .= DOMFactory::getDiv()->addClass('separator');
     return $section;
 }
 protected function account()
 {
     $profile = $this->values->profile;
     $this->template->name = $profile->getFirstname() . SPACE . $profile->getLastname();
     $photo = URL_IMG . 'profile' . DASH . $profile->getGender() . EXT_PNG;
     if ($profile->getAvatar()) {
         $photo = URL_PHOTOS . $profile->getId() . SLASH . 'profile' . EXT_JPG;
     }
     $this->template->photo = DOMFactory::getLink($this->url->getCustomActionURL('profile', $profile->getLogin()), DOMFactory::getImage($photo)->addClass('photo-frame'));
     $this->template->videoLink = DOMFactory::getLink($this->url->getCustomActionURL('video', 'user', array($profile->getLogin())), 'Videos')->addClass('tahoma-13')->addStyle('margin-right: 6px;');
     $this->template->photosLink = DOMFactory::getLink($this->url->getCustomActionURL('photos', 'user', array($profile->getLogin())), 'Photos')->addClass('tahoma-13')->addStyle('margin-right: 6px;');
     $this->template->friendsLink = DOMFactory::getLink($this->url->getCustomActionURL('friends', 'user', array($profile->getLogin())), 'Friends')->addClass('tahoma-13')->addStyle('margin-right: 6px;');
     $this->template->blogLink = DOMFactory::getLink($this->url->getCustomActionURL('blog', 'user', array($profile->getLogin())), 'Blog')->addClass('tahoma-13')->addStyle('margin-right: 6px;');
     $this->template->show($this->url->getActionPath());
 }
 public static function make($pages)
 {
     $url = URL::getInstance();
     $zero = $url->getParameter(self::ZERO);
     $one = $url->getParameter(self::ONE);
     $pageIndex = '';
     for ($i = self::ONE; $i <= intval($pages); $i++) {
         $link = DOMFactory::getLink($url->getParamURL(array($zero, $i)), $i);
         if ($i == $one || $one == null && $i == self::ONE) {
             $link = $i;
         }
         $pageIndex .= $link . SPACE;
     }
     return $pageIndex;
 }
 protected function show()
 {
     if ($this->values->error) {
         $this->template->message = DOMFactory::getDiv($this->values->error)->addClass('error');
     }
     $commentView = new CommentView();
     $commentView->produceComments();
     $this->template->type = $this->url->getController();
     $this->template->id = $this->url->getParameter(0);
     $this->template->sourceId = $this->values->video->getSourceId();
     $this->template->title = $this->values->video->getTitle();
     $this->template->description = $this->values->video->getDescription();
     $this->template->duration = $this->values->video->getLength();
     $this->template->date = Date::convert($this->values->video->getDate(), 'j F Y');
     $this->template->videoObject = $this->template->getTemplate('video', $this->values->video->getType());
     $this->template->link = $this->url->getURL();
     $link = $this->url->getCustomActionURL('profile', $this->values->video->getLogin());
     $this->template->username = DOMFactory::getLink($link, $this->values->video->getUsername());
     $this->template->show($this->url->getActionPath());
 }
 public function index()
 {
     $lipsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ornare sollicitudin elit, vitae vestibulum nisl laoreet vel.';
     $this->template->index = DOMFactory::getDiv($lipsum);
     $this->template->show($this->url->getActionPath('index'));
 }
 private function prepareWelcomeMessage()
 {
     $text = 'Simlandia helps you connect and share with the people in your life.';
     $welcomeMessage = DOMFactory::getDiv($text)->addClass('bold');
     $this->template->welcomeMessage = DOMFactory::getLi($welcomeMessage);
 }