Ejemplo n.º 1
0
    public function home()
    {
        global $core, $bio;
        $v = $this->__(array_merge(w('a r'), _array_keys(w('s'), 0)));
        if (!empty($v->a)) {
        }
        if (!empty($v->r)) {
            $sql = 'SELECT *
				FROM _objects o, _objects_type t, _bio b, _objects_rel_assoc ra, _objects_rel_type rt
				WHERE t.type_alias = ?
					AND rt.type_alias = ?
					AND o.object_bio = b.bio_id
					AND ra.assoc_object = o.object_id
					AND ra.assoc_rel_type = rt.type_id
				ORDER BY o.object_time
				LIMIT ??, ??';
            $news = sql_rowset(sql_filter($sql, 'news', $v->r, $v->s, $core->v('objects_per_page')));
            $sql = 'SELECT COUNT(object_id) AS total
				FROM _objects o, _objects_type t, _objects_rel_assoc ra, _objects_rel_type rt
				WHERE t.type_alias = ?
					AND rt.type_alias = ?
					AND ra.assoc_object = o.object_id
					AND ra.assoc_rel_type = rt.type_id';
            $news_total = sql_field(sql_filter($sql, 'news', $v->r), 'total', 0);
        } else {
            $sql = 'SELECT *
				FROM _objects o, _objects_type t, _bio b
				WHERE t.type_alias = ?
					AND o.object_type = t.type_id
					AND o.object_bio = b.bio_id
				ORDER BY o.object_time
				LIMIT ??, ??';
            $news = sql_rowset(sql_filter($sql, 'news', $v->s, $core->v('objects_per_page')));
            $sql = 'SELECT COUNT(object_id) AS total
				FROM _objects o, _objects_type t
				WHERE t.type_alias = ?
					AND o.object_type = t.type_id';
            $news_total = sql_field(sql_filter($sql, 'news'), 'total', 0);
        }
        foreach ($news as $i => $row) {
            if (!$i) {
                _style('news', _pagination(_link('news'), 's:%d', $news_total + 1, $core->v('objects_per_page'), $v->s));
            }
            $_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => _message($row->object_content), 'TIME' => $bio->format_date($row->object_time));
            _style('news.row', array_merge($_row, $this->_profile($row)));
        }
        $sql = 'SELECT *
			FROM _objects_rel_type
			ORDER BY type_alias';
        $rel_type = sql_rowset($sql);
        foreach ($rel_type as $i => $row) {
            if (!$i) {
                _style('rel_type', array('NEWS_URL' => _link('news')));
            }
            $row->type_alias = _link('news', array('r' => $row->type_alias));
            _style('rel_type.row', $row);
        }
        return;
    }
Ejemplo n.º 2
0
Archivo: _tv.php Proyecto: nopticon/npt
    public function home()
    {
        global $core, $bio;
        $v = $this->__(array_merge(w('r'), _array_keys(w('v'), 0)));
        if (!empty($v->v)) {
            $sql = 'SELECT *
				FROM _objects o, _objects_type t
				WHERE o.object_id = ?
					AND t.type_alias = ?
					AND o.object_type = t.type_id';
            $video = sql_rowset(sql_filter($sql, $v->v, 'tv'));
            $sql = 'SELECT *
				FROM _objects o, _objects_type t, _bio b
				WHERE o.object_id <> ?
					AND t.type_alias = ?
					AND o.object_type = t.type_id
					AND o.object_bio = b.bio_id
				ORDER BY o.object_time';
            $tv_list = sql_rowset(sql_filter($sql, $v->v, 'tv'));
            $tv = w();
            foreach ($video as $row) {
                $tv[] = $row;
            }
            foreach ($tv_list as $row) {
                $tv[] = $row;
            }
            //_pre($tv, true);
        } else {
            $sql = 'SELECT *
				FROM _objects o, _objects_type t, _bio b
				WHERE t.type_alias = ?
					AND o.object_type = t.type_id
					AND o.object_bio = b.bio_id
				ORDER BY o.object_time';
            $tv = sql_rowset(sql_filter($sql, 'tv'));
        }
        foreach ($tv as $i => $row) {
            if (!$i) {
                _style('tv', array('FIRST_SUBJECT' => $row->object_subject));
            }
            //$preg = preg_match("^http://(?<domain>([^./]+\\.)*youtube\\.com)(/v/|/watch\\?v=)(?<videoId>[A-Za-z0-9_-]{11})", $row->object_content);
            preg_match('#(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\\n]+|(?<=embed\\/)[^"&\\n]+|(?<=(?:v|i)=)[^&\\n]+|(?<=youtu.be\\/)[^&\\n]+#', $row->object_content, $preg);
            $embed = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $preg[0] . '" frameborder="0" allowfullscreen></iframe>';
            $_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => $row->object_content, 'VIDEO' => $preg[0], 'EMBED' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '" class="thumbnail"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt=""><br /><h5>' . $row->object_subject . '</h5></a>', 'EMBED2' => !$i ? $embed : '<img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140" rel="' . _link('tv', array('v' => $row->object_id)) . '" />', 'EMBED3' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140"></a>', 'SPAN' => !$i ? 'span6' : 'span2', 'TIME' => $bio->format_date($row->object_time));
            _style('tv.row', array_merge($_row, $this->_profile($row)));
        }
        $sql = 'SELECT *
			FROM _objects_rel_type
			ORDER BY type_alias';
        $rel_type = sql_rowset($sql);
        foreach ($rel_type as $i => $row) {
            if (!$i) {
                _style('rel_type', array('TV_URL' => _link('tv')));
            }
            $row->type_alias = _link('tv', array('r' => $row->type_alias));
            _style('rel_type.row', $row);
        }
        return;
    }
Ejemplo n.º 3
0
    protected function _import_news()
    {
        $sql = 'SELECT *
			FROM _news
			ORDER BY post_time';
        $news = _rowset($sql);
        foreach ($news as $row) {
            $sql_insert = array('type' => 1, 'title' => $row['post_subject'], 'desc' => $row['post_desc'], 'link' => _link('news', $row['news_id']), 'time' => $row['post_time'], 'author' => $row['poster_id']);
            sql_put('_reference', prefix('ref', $sql_insert));
        }
        return $this->e('~OK:' . count($news));
    }
Ejemplo n.º 4
0
    public function home()
    {
        global $core;
        $v = $this->__(array('a', 'p' => 0));
        if (f($v['a'])) {
            $sql = 'SELECT area_id
				FROM _reference_area
				WHERE area_alias = ?';
            if (!_field(sql_filter($sql, $v['a']), 'area_id', 0)) {
                _fatal();
            }
            $sql = 'SELECT COUNT(r.ref_id) AS total
				FROM _reference r, _reference_area a
				WHERE a.area_alias = ?
					AND r.ref_area = a.area_id
				ORDER BY r.ref_time DESC';
            $ref_total = _field(sql_filter($sql, $v['a']), 'total', 0);
            $sql = 'SELECT *
				FROM _reference r, _reference_area a
				WHERE a.area_alias = ?
					AND r.ref_area = a.area_id
				ORDER BY r.ref_time DESC
				LIMIT ??, ??';
            $ref = _rowset(sql_filter($sql, $v['a'], $v['p'], $core->v('ref_pages')));
        } else {
            $sql = 'SELECT COUNT(ref_id) AS total
				FROM _reference
				ORDER BY ref_time DESC';
            $ref_total = _field($sql, 'total', 0);
            $sql = 'SELECT *
				FROM _reference r, _reference_area a
				WHERE r.ref_area = a.area_id
				ORDER BY r.ref_time DESC
				LIMIT ??, ??';
            $ref = _rowset(sql_filter($sql, $v['p'], $core->v('ref_pages')));
        }
        if ($v['p'] && $ref_total) {
            redirect(_link());
        } else {
            _style('noref');
        }
        foreach ($ref as $i => $row) {
            if (!$i) {
                _style('ref');
            }
            if ($this->has_plugin($row['ref_content'])) {
                $this->parse_plugin($row);
                continue;
            }
            _style('ref.row', _vs(array('id' => $row['ref_id'], 'link' => _link($row['ref_alias']), 'subject' => $row['ref_subject'], 'content' => _message($row['ref_content']), 'time' => _format_date($row['ref_time'])), 'ref'));
        }
        return;
    }
Ejemplo n.º 5
0
function go($section = 'home', $action = 'index', $extra = '')
{
    if (is_array($extra)) {
        $i = 1;
        $outParams = '&';
        foreach ($extra as $item) {
            $outParams .= 'param' . $i . '=' . $item . '&';
            $i++;
        }
    } else {
        $outParams = $extra;
    }
    return _link($section, $action, $outParams);
}
Ejemplo n.º 6
0
 public function linkToViewPage($object, $params)
 {
     try {
         $page = $object->getDmPage();
     } catch (Exception $e) {
         if (sfConfig::get('dm_debug')) {
             throw $e;
         }
         return '';
     }
     if (!$page) {
         return '';
     }
     return '<li class="sf_admin_action_view_page">' . _link('app:front/' . $page->get('slug'))->title(__($params['title'], array('%1%' => dmString::strtolower(__($this->getModule()->getName()))), $this->getI18nCatalogue()))->text(__($params['label'], array(), 'dm'))->set('.s16.s16_file_html.sf_admin_action')->target('blank') . '</li>';
 }
Ejemplo n.º 7
0
    public function home()
    {
        $now = time();
        $sql = 'SELECT *
			FROM _contest
			WHERE contest_start > ??
				AND contest_end < ??
			ORDER BY contest_start';
        $contest = sql_rowset(sql_filter($sql, $now, $now));
        foreach ($contest as $i => $row) {
            if (!$i) {
                _style('contest');
            }
            _style('contest.row', array('URL' => _link('contest', $row->contest_alias), 'SUBJECT' => $row->contest_subject, 'END' => _format_date($row->contest_end)));
        }
        return;
    }
Ejemplo n.º 8
0
    public function home()
    {
        global $core, $bio;
        $page = 15;
        $today = _htimestamp('md');
        _pre($bio->v('is_bio'), true);
        _style('status_post');
        // Friends birthday
        if ($bio->v('auth_member')) {
            $sql = "SELECT bio_id, bio_alias, bio_name\r\n\t\t\t\tFROM _bio\r\n\t\t\t\tWHERE bio_id IN (\r\n\t\t\t\t\t\tSELECT fan_of\r\n\t\t\t\t\t\tFROM _bio_fans\r\n\t\t\t\t\t\tWHERE fan_assoc = ?\r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND bio_active = ?\r\n\t\t\t\t\tAND bio_birth LIKE '%??'\r\n\t\t\t\tORDER BY bio_name";
            $birthday = _rowset(sql_filter($sql, $bio->v('bio_id'), 1, $today));
        } else {
            $sql = "SELECT bio_id, bio_alias, bio_name, bio_avatar, bio_avatar_up\r\n\t\t\t\tFROM _bio\r\n\t\t\t\tWHERE bio_level = ?\r\n\t\t\t\t\tAND bio_birth LIKE '%??'\r\n\t\t\t\tORDER BY bio_name";
            $birthday = _rowset(sql_filter($sql, 1, $today));
        }
        foreach ($birthday as $i => $row) {
            if (!$i) {
                _style('birthday');
            }
            _style('birthday.row', array('A' => _a($row), 'NAME' => $row['bio_name'], 'AVATAR' => _avatar($row)));
        }
        // Board topics
        if ($bio->v('auth_member')) {
            $sql = 'SELECT t.topic_id, t.topic_alias, t.topic_title, h.highlight_class
				FROM _board_topics t
				INNER JOIN _board_forums f ON f.forum_id = t.topic_forum
				LEFT JOIN _board_highlight h ON t.topic_highlight = h.highlight_id
				RIGHT JOIN _board_disallow d ON t.topic_id = d.disallow_topic AND d.disallow_bio = ?
				WHERE t.topic_show = ?
				ORDER BY t.topic_shine DESC, t.topic_time DESC
				LIMIT ??';
            $topics = _rowset(sql_filter($sql, $bio->v('bio_id'), 1, 10));
        } else {
            $sql = 'SELECT t.topic_id, t.topic_alias, t.topic_title, h.highlight_class
				FROM _board_topics t
				INNER JOIN _board_forums f ON f.forum_id = t.topic_forum
				LEFT JOIN _board_highlight h ON t.topic_highlight = h.highlight_id
				WHERE t.topic_show = ?
				ORDER BY t.topic_shine DESC, t.topic_time DESC
				LIMIT ??';
            $topics = _rowset(sql_filter($sql, 1, 10));
        }
        foreach ($topics as $i => $row) {
            if (!$i) {
                _style('board_topics');
            }
            _style('board_topics.row', _vs(array('ID' => $row['topic_id'], 'TITLE' => $row['topic_title'], 'CLASS' => $row['highlight_class']), 'TOPIC'));
        }
        if ($bio->v('auth_member')) {
            // Messages
            $sql = 'SELECT *
				FROM _bio_messages
				INNER JOIN _bio ON message_from = bio_id
				INNER JOIN _bio_messages_type ON message_type = type_id
				WHERE message_to = ?
					AND message_active = ?
				ORDER BY message_time DESC';
            $messages = _rowset(sql_filter($sql, $bio->v('bio_id'), 1));
            foreach ($messages as $i => $row) {
                if (!$i) {
                    _style('messages');
                }
                _style('messages.row', array('U_MESSAGE' => _link(), '' => ''));
            }
            // Friend requests
            $sql = 'SELECT b.bio_alias, b.bio_name
				FROM _bio_friends
				INNER JOIN _bio ON friend_assoc = bio_id
				WHERE friend_bio = ?
					AND friend_pending = ?
				ORDER BY friend_time DESC';
            $requests = _rowset(sql_filter($sql, $bio->v('bio_id'), 1));
            foreach ($requests as $i => $row) {
                if (!$i) {
                    _style('friend_request');
                }
                _style('friend_request.row', array('U_APPROVE' => _link('home', array('x1' => 'friend', 'x2' => 'approve', 'a' => $row['bio_alias'])), 'U_DENY' => _link('home', array('x1' => 'friend', 'x2' => 'deny', 'a' => $row['bio_alias'])), 'A' => _a($row), 'BIO_NAME' => $row['bio_name']));
            }
        }
        // Banners
        $this->announce('home');
        return;
    }
Ejemplo n.º 9
0
<?php

// Vars: $categoryPager
echo $categoryPager->renderNavigationTop();
echo _open('ul.elements');
foreach ($categoryPager as $category) {
    echo _open('li.element');
    echo _link($category);
    echo _close('li');
}
echo _close('ul');
echo $categoryPager->renderNavigationBottom();
Ejemplo n.º 10
0
<?php

TPL::thing('head', 'css', 'http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.1/summernote.css');
_inc("parts/header");
?>
<h1>Adauga > Pagina de Produs</h1>
<hr>

<form class="form-horizontal" role="form" method="post" action="<?php 
_link("admin_pages_add", "page_poli_products");
?>
" enctype="multipart/form-data">
        
    <?php 
_inc("parts/messages");
?>

    <div class="form-group">
        <label class="control-label col-sm-2" for="produs_denumire">Denumire produs:</label>
        <div class="col-sm-6">
            <input type="text" class="form-control" id="produs_denumire" name="produs_denumire" placeholder="Introduceti denumirea produsului" value="<?php 
_post("produs_denumire");
?>
">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="produs_imagini">Imagini:</label>
        <div class="col-sm-6">
            <input type="file" id="produs_imagini" name="produs_imagini[]" class="form-control" value="<?php 
_post("produs_imagini");
Ejemplo n.º 11
0
$helper->boot('front');
$t = new lime_test(47);
dm::loadHelpers(array('Dm'));
sfConfig::set('sf_no_script_name', false);
dmDb::table('DmPage')->checkBasicPages();
$sc = $helper->get('service_container');
$sc->mergeParameter('link_tag_record.options', array('current_span' => false))->mergeParameter('link_tag_page.options', array('current_span' => false));
$t->diag('link current_span is false');
$home = dmDb::table('DmPage')->getTree()->fetchRoot();
$helper->get('context')->setPage($home);
$t->diag($home->name . ' is the current page');
$testPage = dmDb::create('DmPage', array('module' => 'main', 'action' => 'test' . dmString::random(12), 'name' => 'I am a root child', 'slug' => dmString::random()));
$testPage->Node->insertAsLastChildOf($home);
$scriptName = $helper->get('request')->getScriptName();
$t->diag('Current cli script name = ' . $scriptName);
$t->is((string) _link('http://c2.com/cgi/wiki?DontRepeatYourself')->text('DRY'), $expected = '<a class="link" href="http://c2.com/cgi/wiki?DontRepeatYourself">DRY</a>', $expected);
$t->like(£link()->render(), '|<a class="link dm_current|', '£link() has class dm_current');
$t->like(£link()->set('current_class', 'my_current')->render(), '|<a class="link my_current|', '£link() has class my_current');
$t->is((string) £link($home), (string) £link(), '£link($home) is £link()');
$t->is((string) £link('@homepage'), (string) £link($home), '£link("@homepage") is £link()');
$t->is((string) £link('main/root'), (string) £link($home), '£link("main/root") is £link()');
$t->is(£link()->getHref(), $scriptName, 'root href is ' . $scriptName);
$t->is(£link()->getText(), $home->name, 'root link text is ' . $home->name);
$expected = $helper->get('controller')->genUrl('dmAuth/signin');
$t->is(£link('+/dmAuth/signin')->getHref(), $expected, '+/dmAuth/signin href is ' . $expected);
$rootLink = sprintf('<a class="%s" href="%s">%s</a>', 'link dm_current', $scriptName, $home->name);
$t->is((string) £link(), $rootLink, 'root link is ' . $rootLink);
$rootLink = sprintf('<a class="%s" href="%s">%s</a>', 'link dm_current', $scriptName, $home->name);
$t->is((string) $helper->get('helper')->link(), $rootLink, 'use the helper service : root link is ' . $rootLink);
$hrefWithParam = $scriptName . '?var=val&other=value';
$t->is((string) £link()->param('var', 'val')->param('other', 'value')->getHref(), $hrefWithParam, $hrefWithParam);
Ejemplo n.º 12
0
<?php

echo _open('div.dm.dm_auth.unsupported_browser');
echo _tag('h1.site_name', dmConfig::get('site_name'));
echo _tag('div.message', _tag('p.dm_browser_unsupported.mt10', __("Sorry, it looks like you're using a browser that isn't supported.")) . _tag('p.dm_browser_suggestion.mt10', __("We suggest that you use one of these browsers:")) . _tag('div.dm_suggested_browsers.clearfix', _link('http://www.mozilla.com/firefox/')->text(_media('dmCore/images/64/firefox.png')->size(64, 64) . 'Firefox') . _link('http://www.google.com/chrome')->text(_media('dmCore/images/64/chrome.png')->size(64, 64) . 'Chrome') . _link('http://www.apple.com/safari/')->text(_media('dmCore/images/64/safari.png')->size(64, 64) . 'Safari') . _link('http://www.opera.com/browser/')->text(_media('dmCore/images/64/opera.png')->size(64, 64) . 'Opera')) . _tag('div.dm_skip_browser_detection', _link('@signin?skip_browser_detection=1')->text(__('Or continue at your own peril'))));
echo _close('div');
echo _link('http://diem-project.org/')->text('Diem CMF CMS for symfony')->set('.generator_link');
Ejemplo n.º 13
0
<?php

// Vars: $productPager
echo $productPager->renderNavigationTop();
echo _open('div.catalog');
foreach ($productPager as $product) {
    if ($product->is_in_action) {
        echo _open('div.product');
        echo _tag('div.title', _link($product));
        echo _tag('div.picture', _link($product)->text(_media($product->Photo)->size(80, 80)));
        echo _tag('div.description', $product->description);
        echo _tag('div.price', 'old price: ' . _tag('strike', round($product->price)));
        echo _tag('div.price', 'new price: ' . _tag('span.new_price', round($product->price_action)));
        echo _link('+/product/add_to_cart?id=' . $product->id)->text('add to cart');
    } else {
        echo _open('div.product');
        echo _tag('div.title', _link($product));
        echo _tag('div.picture', _link($product)->text(_media($product->Photo)->size(80, 80)));
        echo _tag('div.description', $product->description);
        echo _tag('div.price', 'price: ' . _tag('span.new_price', round($product->price_action)));
        echo _link('+/product/add_to_cart?id=' . $product->id)->text('add to cart');
    }
    echo _close('div');
    // cat_good
}
echo _close('div');
// catalog
echo $productPager->renderNavigationBottom();
Ejemplo n.º 14
0
<?php

/*
 * An $item is an array containing:
 * - title:       title of the feed item
 * - link:        url of the feed item
 * - content:     HTML content
 * - pub_date:    item publication date (timestamp)
 * - author_name: author name
 * - author_link: author link
 * - author_email: author email
 */
echo _open('ul');
foreach ($items as $item) {
    echo _tag('li', _link($item['link'])->text($item['title'])->set('.feed_item_link') . _tag('div.feed_item_content', dmString::truncate(strip_tags($item['content']), 100)));
}
echo _close('ul');
Ejemplo n.º 15
0
<?php

// Dm test domain : Show
// Vars : $dmTestDomain
echo _open('div.dm_test_domain.show');
echo _tag('h1', $dmTestDomain);
echo _open('ul');
foreach ($dmTestDomain->getTags() as $tag) {
    echo _tag('li', _link($tag));
}
echo _close('ul');
echo _open('ul');
foreach ($dmTestDomain->getRelatedRecords() as $domain) {
    echo _tag('li', _link($domain));
}
echo _close('ul');
echo _close('div');
Ejemplo n.º 16
0
<?php

// Dm test domain : List
// Vars : $dmTestDomainPager
echo _open('div.dm_test_domain.list');
echo $dmTestDomainPager->renderNavigationTop();
echo _open('ul.elements');
foreach ($dmTestDomainPager as $dmTestDomain) {
    echo _open('li.element');
    echo _link($dmTestDomain);
    echo _close('li');
}
echo _close('ul');
echo $dmTestDomainPager->renderNavigationBottom();
echo _close('div');
Ejemplo n.º 17
0
<?php

// Dm test post : Show
// Vars : $dmTestPost
echo _open('div.dm_test_post.show');
echo _tag('h1', $dmTestPost), _tag('p.user', $dmTestPost->Author) . _tag('p.excerpt', $dmTestPost->excerpt) . _tag('div.body', markdown($dmTestPost->body)) . _tag('p.url', _link($dmTestPost->url)) . _tag('p.categ', _link($dmTestPost->Categ)) . _tag('p.image', _media($dmTestPost->Image)->size(200, 200)) . _tag('p.file', _link($dmTestPost->File)) . _tag('p.date', $dmTestPost->date);
echo _close('div');
Ejemplo n.º 18
0
$menu->addChild('Home', '@homepage')->end()->addChild('Sites')->ulClass('my_ul_class')->addChild('Diem', 'http://diem-project.org')->showId(true)->end()->addChild('Symfony', 'http://symfony-project.org')->end();
$html = _tag('ul', _tag('li.first', _link('@homepage')->text($helper->get('i18n')->__('Home'))) . _tag('li.last', 'Sites' . _tag('ul.my_ul_class', _tag('li#my-menu-diem.first', _link('http://diem-project.org')->text('Diem')) . _tag('li.last', _link('http://symfony-project.org')->text('Symfony')))));
$t->is($menu->render(), $html, $html);
$t->comment('Test getRoot');
$t->is($menu['Home']->getRoot(), $menu, 'Home root is $menu');
$t->is($menu['Sites']['Diem']->getRoot(), $menu, 'Diem root is menu');
$sitemap = $helper->get('sitemap_menu')->build();
$t->isa_ok($sitemap, 'dmSitemapMenu', 'Got a dmSitemapMenu');
$t->is($sitemap->getFirstChild()->renderLink(), (string) _link(), 'Sitemap first child is Home');
$t->like((string) $sitemap, '|^' . preg_quote('<ul><li class="first last"><a class="link" href="', '|') . '.*|', 'Sitemap html is valid');
$t->comment('Test current page');
$homePage = dmDb::table('DmPage')->getTree()->fetchRoot();
$helper->getContext()->setPage($homePage);
$menu = $helper->get('menu')->addChild('Home', '@homepage')->end();
$html = _tag('ul', _tag('li.first.last.dm_current', _link()->text($helper->get('i18n')->__('Home'))));
$t->is($menu->render(), $html, 'Current li has the dm_current class');
$helper->getContext()->setPage(dmDb::table('DmPage')->findOneByModuleAndAction('main', 'signin'));
$menu = $helper->get('menu')->addChild('Home', '@homepage')->end();
$html = _tag('ul', _tag('li.first.last.dm_parent', _link()->text($helper->get('i18n')->__('Home'))));
$t->is($menu->render(), $html, 'Parent li has the dm_parent class');
$menu = $helper->get('menu')->addChild('Home')->end()->addChild('Sites')->addChild('Diem')->end()->addChild('Symfony')->end()->end();
$html = _tag('ul', _tag('li.first', 'Home') . _tag('li.last', 'Sites' . _tag('ul', _tag('li.first', 'Diem') . _tag('li.last', 'Symfony'))));
$t->is($menu->render(), $html, $html);
$t->comment('->getSiblings()');
$t->is_deeply($menu['Home']->getSiblings(), array('Sites' => $menu['Sites']), '->getSiblings() works');
$t->is_deeply($menu['Home']->getSiblings(true), array('Home' => $menu['Home'], 'Sites' => $menu['Sites']), '->getSiblings(true) works');
$t->comment('Move menus');
$menu['Home']->moveToLast();
$menu['Sites']['Symfony']->moveToFirst();
$html = _tag('ul', _tag('li.first', 'Sites' . _tag('ul', _tag('li.first', 'Symfony') . _tag('li.last', 'Diem'))) . _tag('li.last', 'Home'));
$t->is($menu->render(), $html, $html);
Ejemplo n.º 19
0
<?php

if (!$pager) {
    echo _tag('h2', __('No results'));
    return;
}
//include_partial('pager', array('pager' => $pager));
echo _tag('h2', __('%1% - %2% of %3%', array('%1%' => $pager->getFirstIndice(), '%2%' => $pager->getLastIndice(), '%3%' => $pager->getNbResults())));
echo _open("ol.search_results.clearfix start=" . $pager->getFirstIndice());
foreach ($pager->getResults() as $result) {
    echo _tag("li.search_result.ml20.mb5", _tag("span.score.mr10", round(100 * $result->getScore()) . "%") . _link('app:front/' . $result->getPage()->slug)->text(_tag('strong', $result->getPage()->name) . _tag('span.ml10', $result->getPage()->description)));
}
echo _close("ol");
//include_partial('pager', array('pager' => $pager));
Ejemplo n.º 20
0
 /**
  * Checks for empty variable and shows language variable if possible.
  */
 function lang($var)
 {
     global $user, $core;
     $prefix = substr($var, 0, 2);
     $value = substr($var, 2);
     $response = '';
     switch ($prefix) {
         case 'L_':
             if (is_lang($value)) {
                 return _lang($value);
             }
             return $value;
             break;
         case 'U_':
             $module = '';
             $v_args = array();
             $e_name = explode('_', $value);
             if (count($e_name) > 0) {
                 $e_name[0] = strtolower($e_name[0]);
                 $module = $e_name[0] != 'home' ? $e_name[0] : '';
                 unset($e_name[0]);
                 foreach ($e_name as $row) {
                     $k = '';
                     $v = $row;
                     $e_row = explode(':', $row);
                     if (isset($e_row[1])) {
                         $k = $e_row[0];
                         $v = $e_row[1];
                     }
                     $v_args[$k] = $v;
                 }
             }
             $response = _link($module, $v_args);
             break;
     }
     return $response;
 }
Ejemplo n.º 21
0
<?php

// Vars: $form
echo _tag('h1.t_big', 'Modify ' . $plugin->name) . _link($plugin)->text(escape(__('< Back to the plugin'))) . $form->open() . _tag('ul.dm_form_elements', $form->getFormFieldSchema()->render() . _tag('li.dm_form_element', $form->renderSubmitTag(__('Update the plugin'), '.button.blue.large'))) . $form->renderHiddenFields() . $form->close() . '<hr />' . _link('@plugin_delete')->param('name', $plugin->name)->text(__('Delete this plugin'))->set('.js_confirm');
Ejemplo n.º 22
0
    protected function _comments_home()
    {
        global $user;
        $tree = $this->valid_tree();
        if (!$tree['tree_allow_comments']) {
            _fatal();
        }
        $sql = 'SELECT *
			FROM _comments c, _members m
			WHERE c.comment_tree = ?
				AND c.comment_uid = m.user_id
			ORDER BY comment_time DESC';
        $comments = _rowset(sql_filter($sql, $tree['tree_id']));
        foreach ($comments as $i => $row) {
            if (!$i) {
                _style('comments');
            }
            _style('comments.row', array('ID' => $row['comment_id'], 'USERNAME' => $row['comment_username'], 'EMAIL' => $row['comment_email'], 'WEBSITE' => $row['comment_website'], 'IP' => $row['comment_ip'], 'STATUS' => $row['comment_status'], 'TIME' => _format_date($row['comment_time']), 'MESSAGE' => $row['comment_message'], 'U_VALIDATION' => _link(_rewrite($tree), array('x1' => 'comments', 'x2' => 'validation'))));
        }
        if (!count($comments)) {
            _style('no_comments');
        }
        return $this->_template('tree_comments');
    }
Ejemplo n.º 23
0
function _Footer()
{
    _link("Home", "../index.php");
    echo "</BODY></HTML>";
}
Ejemplo n.º 24
0
<?php

echo _open('div#dm_page_bar.dm');
echo _tag('p.title', __('Site tree') . _link('dmPage/reorderPages')->text(__('Edit'))->set('.fright.mr10.s16.s16_sort'));
echo '<div id="dm_page_tree" class="dm_tree"></div>';
echo _close('div');
echo '<div id="dm_page_bar_toggler"></div>';
Ejemplo n.º 25
0
                                            <input type="password" name="password" id="password" class="form-control required" placeholder="Enter Password" required>
                                        </div>
                                     <div class="form-group input-group">
                                            <span class="input-group-addon"><i class="fa fa-lock"></i></span>
                                            <input type="password" name="cpassword" id="cpassword" class="form-control required" placeholder="Retype Password" required>
                                        </div>
                                     
                                     
                                    <input type="submit"  class="btn btn-success" style='float:right;'  value="Register Me">
									<br/><hr>
                                    Already Registered ?  <a href="<?php 
echo _link("login");
?>
">Login here</a>
                                    OR <a href="<?php 
echo _link("home");
?>
">Go Home</a>
                                    </form>
                            </div>
                           
                        </div>
            </div>
    </div>
</div>
<script>
	$(function() {
	$('#registrationForm').submit(function(e){	
		saveUser();
		return false;
	});
Ejemplo n.º 26
0
<?php

// Vars: $productPager
//echo $productPager->renderNavigationTop();
echo _open('ul.elements');
foreach ($productPager as $product) {
    echo _open('li.element');
    echo _link($product);
    echo _close('li');
}
echo _close('ul');
$productPager->setOption('first', false)->setOption('prev', '← предыдущая')->setOption('next', 'следующая →')->setOption('last', false);
// disable last button
echo $productPager->renderNavigationBottom(array());
Ejemplo n.º 27
0
<?php

echo _tag('div.clearfix', _link('@blog_rss')->text('Diem blog syndication')->title('Subscribe to the blog feed')->set('.rss_link') . _tag('h1.t_big', 'Blog'));
Ejemplo n.º 28
0
<?php

// Vars: $monografiaPager
use_helper('Date');
echo $monografiaPager->renderNavigationTop();
echo _open('ul.elements');
foreach ($monografiaPager as $monografia) {
    echo _open('li.element');
    echo _link($monografia)->set('.titulo_link')->text($monografia->titulo);
    if ($monografia->resumen) {
        echo markdown($monografia->resumen, '.resumen');
    } else {
        echo _tag('p.recurso_list', 'Sin resumen');
    }
    echo _tag('p.recurso_infos', _tag('span', format_date($monografia->createdAt, 'D')) . '|' . _tag('span', $monografia->editorial) . '|' . _link($monografia)->text(__('Leer m&aacutes...')));
    echo _close('li');
}
echo _close('ul');
echo $monografiaPager->renderNavigationBottom();
Ejemplo n.º 29
0
    protected function _tech_add()
    {
        global $user, $core;
        gfatal();
        if (!_auth_get('ticket_assign_tech') && !_auth_get('ticket_auto_assign')) {
            _fatal();
        }
        $v = $this->__(array('ticket' => 0, 'tech'));
        if (_auth_get('ticket_auto_assign') && !$user->v('is_founder') && $user->v('user_username') != $v['tech']) {
            $this->_error('NO_ASSIGN_OTHER');
        }
        $sql = 'SELECT *
			FROM _tickets t, _groups g
			WHERE t.ticket_id = ?
				AND t.ticket_group = g.group_id';
        if (!($tdata = _fieldrow(sql_filter($sql, $v['ticket'])))) {
            $this->_error('NOT_MEMBER_2');
        }
        $sql = 'SELECT user_id
			FROM _members
			WHERE user_username = ?';
        $v['tech'] = _field(sql_filter($sql, $v['tech']), 'user_id', 0);
        $sql = 'SELECT *
			FROM _members
			WHERE user_id = ?';
        if (!($techdata = _fieldrow(sql_filter($sql, $v['tech'])))) {
            $this->_error('NOT_MEMBER');
        }
        $sql = 'SELECT ticket_id
			FROM _tickets
			WHERE ticket_contact = ?
				AND ticket_id = ?';
        if ($row1 = _field(sql_filter($sql, $v['tech'], $v['ticket']), 'ticket_id', 0)) {
            $this->_error('CANT_ASSIGN');
        }
        $sql = 'SELECT *
			FROM _tickets_assign
			WHERE user_id = ?
				AND assign_ticket = ?';
        if ($row2 = _fieldrow(sql_filter($sql, $v['tech'], $v['ticket']))) {
            $this->_error('ALREADY_ASSIGN');
        }
        $sql = 'SELECT *
			FROM _members
			WHERE user_id = ?';
        if (!($cdata = _fieldrow(sql_filter($sql, $tdata['ticket_contact'])))) {
            $this->_error('NOT_MEMBER_3');
        }
        $sql_insert = array('assign_ticket' => $v['ticket'], 'user_id' => $v['tech'], 'assign_status' => $tdata['ticket_status'], 'assign_end' => 0);
        $sql = 'INSERT INTO _tickets_assign' . _build_array('INSERT', $sql_insert);
        _sql($sql);
        // Send notification
        require_once XFS . 'core/emailer.php';
        $emailer = new emailer();
        $ticket_subject = entity_decode($tdata['group_name'] . ' [#' . $tdata['ticket_code'] . ']: ' . $tdata['ticket_title']);
        $ticket_message = entity_decode($tdata['ticket_text']);
        $emailer->from($tdata['group_email'] . '@' . $core->v('domain'));
        $emailer->email_address($techdata['user_email']);
        $emailer->use_template('ticket_tech');
        $emailer->set_subject($ticket_subject);
        $emailer->assign_vars(array('USERNAME' => $techdata['user_username'], 'FULLNAME' => entity_decode(_fullname($cdata)), 'SUBJECT' => entity_decode($tdata['ticket_title']), 'MESSAGE' => $ticket_message, 'TICKET_URL' => _link($this->m(), array('x1' => 'view', 'code' => $tdata['ticket_code']))));
        $emailer->send();
        $emailer->reset();
        return $this->e(_fullname($cdata));
    }
Ejemplo n.º 30
0
echo _tag('span.descriptor', 'Pa&iacutes: ' . _tag('span.recurso_list', $patente->pais));
echo _close('p');
echo _open('p');
echo _tag('span.descriptor', 'Instituci&oacuten: ' . _tag('span.recurso_list', $patente->institucion));
echo _close('p');
echo _open('p');
echo _tag('span.descriptor', 'No. de publicaci&oacuten: ' . _tag('span.recurso_list', $patente->num_internacional));
echo _close('p');
echo _open('p');
echo _tag('span.descriptor', 'Idioma: ' . _tag('span.recurso_list', $patente->idioma));
echo _close('p');
echo _open('p');
if ($patente->formato_duro) {
    if ($patente->prestado) {
        $records = dmDb::query('SolicitudPrestamo s')->where('s.dm_user_id = ?', sfContext::getInstance()->getUser()->getUserId())->andwhere('s.recurso_id = ?', $patente->id)->fetchRecords();
        $cont = 0;
        foreach ($records as $record) {
            $cont++;
        }
        if ($cont >= 1) {
            echo _tag('span.descriptor', 'Disponible: ' . _tag('span.recurso_list', 'No ' . _tag('span.recurso_list.aviso', 'Usted ser&aacute avisado cuando este recurso est&eacute disponible')));
        } else {
            echo _tag('span.descriptor', 'Disponible: No. ' . _link('+/SolicitudPrestamo/solicitar')->text('Avisarme cuando est&eacute disponible'));
        }
    } else {
        echo _tag('span.descriptor', 'Disponible: ' . _tag('span.recurso_list', 'S&iacute'));
    }
} else {
    echo _link($patente->Slide)->title('Descargar patente')->set('.image_descargar')->text(_media('download.png')->alt('Descargar patente'));
}
echo _close('div');