Example #1
0
function get_parent_subcategories($category_id)
{
    $subcategory = array();
    View::newInstance()->_exportVariableToView('category', osc_get_category('id', $category_id));
    osc_goto_first_category();
    while (osc_has_subcategories()) {
        $sc = array('name' => osc_category_name(), 'url' => osc_search_category_url());
        array_push($subcategory, $sc);
    }
    return $subcategory;
}
<?php

$category = osc_get_category('id', osc_item_category_id());
$category_url = osc_search_url(array('sCategory' => $category['s_slug']));
?>
<div class="item <?php 
echo $class;
if (osc_item_is_premium()) {
    echo ' premium';
}
?>
">
    <?php 
if (osc_images_enabled_at_items()) {
    ?>
        <?php 
    if (osc_count_item_resources()) {
        ?>
            <a class="" href="<?php 
        echo osc_item_url();
        ?>
" title="<?php 
        echo osc_esc_html(osc_item_title());
        ?>
"><img src="<?php 
        echo osc_resource_original_url();
        ?>
" title="" alt="<?php 
        echo osc_esc_html(osc_item_title());
        ?>
" width="220" ></a>
Example #3
0
function osc_footer_link_title($f = null)
{
    if ($f == null) {
        if (View::newInstance()->_exists('footer_link')) {
            $f = View::newInstance()->_get('footer_link');
        } else {
            return '';
        }
    } else {
        View::newInstance()->_exportVariableToView('footer_link', $f);
    }
    $text = '';
    if (osc_get_preference('seo_title_keyword') != '') {
        $text .= osc_get_preference('seo_title_keyword') . ' ';
    }
    $cat = osc_get_category('id', $f['fk_i_category_id']);
    if (@$cat['s_name'] != '') {
        $text .= $cat['s_name'] . ' ';
    }
    if (osc_search_region() == '') {
        $text .= $f['s_region'];
    } else {
        $text .= $f['s_city'];
    }
    $text = trim($text);
    return $text;
}
<?php

$category = osc_get_category('id', osc_premium_category_id());
$category_url = osc_search_url(array('sCategory' => $category['s_slug']));
?>
<div class="item <?php 
echo $class;
if (osc_premium_is_premium()) {
    echo ' premium';
}
?>
">
    <?php 
if (osc_images_enabled_at_items()) {
    ?>
        <?php 
    if (osc_count_premium_resources()) {
        ?>
            <a class="" href="<?php 
        echo osc_premium_url();
        ?>
" title="<?php 
        echo osc_esc_html(osc_premium_title());
        ?>
"><img src="<?php 
        echo osc_resource_url();
        ?>
" title="" alt="<?php 
        echo osc_esc_html(osc_premium_title());
        ?>
" width="220" ></a>
Example #5
0
function get_parent_category_id($iCategoryId)
{
    $aCategory = osc_get_category('id', $iCategoryId);
    return $aCategory['fk_i_parent_id'];
}
Example #6
0
function osc_footer_link_title()
{
    $f = View::newInstance()->_get('footer_link');
    $text = '';
    if (osc_get_preference('seo_title_keyword') != '') {
        $text .= osc_get_preference('seo_title_keyword') . ' ';
    }
    if (osc_search_category_id()) {
        $cat = osc_get_category('id', $f['fk_i_category_id']);
        $text .= strtolower($cat['s_name']) . ' ';
    }
    if (osc_search_region() == '') {
        $text .= $f['s_region'];
    } else {
        $text .= $f['s_city'];
    }
    $text = trim($text);
    return ucfirst($text);
}
Example #7
0
 public function init()
 {
     if (in_array($this->getLocation(), array('item', 'page', 'search', 'login', 'register', 'user', 'contact'))) {
         $l = array('url' => osc_base_url(), 'title' => osc_page_title());
         $this->addLevel($l);
     }
     switch ($this->getLocation()) {
         case 'item':
             if ($this->getSection() == 'item_add') {
                 $l = array('title' => $this->title['item_add']);
                 $this->addLevel($l);
                 break;
             }
             $aCategory = osc_get_category('id', osc_item_category_id());
             // remove
             View::newInstance()->_erase('categories');
             View::newInstance()->_erase('subcategories');
             View::newInstance()->_exportVariableToView('category', $aCategory);
             $l = array('url' => osc_search_category_url(), 'title' => osc_category_name());
             $this->addLevel($l);
             switch ($this->getSection()) {
                 case 'item_edit':
                     $l = array('url' => osc_item_url(), 'title' => osc_item_title());
                     $this->addLevel($l);
                     $l = array('title' => $this->title['item_edit']);
                     $this->addLevel($l);
                     break;
                 case 'send_friend':
                     $l = array('url' => osc_item_url(), 'title' => osc_item_title());
                     $this->addLevel($l);
                     $l = array('title' => $this->title['item_send_friend']);
                     $this->addLevel($l);
                     break;
                 case 'contact':
                     $l = array('url' => osc_item_url(), 'title' => osc_item_title());
                     $this->addLevel($l);
                     $l = array('title' => $this->title['item_contact']);
                     $this->addLevel($l);
                     break;
                 case '':
                     $l = array('title' => osc_item_title());
                     $this->addLevel($l);
                     break;
             }
             break;
         case 'search':
             $region = osc_search_region();
             $city = osc_search_city();
             $pattern = osc_search_pattern();
             $category = osc_search_category_id();
             $category = count($category) == 1 ? $category[0] : '';
             $b_show_all = $pattern == '' && $category == '' && $region == '' && $city == '';
             $b_category = $category != '';
             $b_pattern = $pattern != '';
             $b_region = $region != '';
             $b_city = $city != '';
             $b_location = $b_region || $b_city;
             // show all
             if ($b_show_all) {
                 $l = array('title' => $this->title['search']);
                 $this->addLevel($l);
                 break;
             }
             // category
             if ($b_category) {
                 $aCategories = Category::newInstance()->toRootTree($category);
                 foreach ($aCategories as $c) {
                     View::newInstance()->_erase('categories');
                     View::newInstance()->_erase('subcategories');
                     View::newInstance()->_exportVariableToView('category', $c);
                     $l = array('url' => osc_search_category_url(), 'title' => osc_category_name());
                     $this->addLevel($l);
                 }
             }
             // location
             if ($b_location) {
                 $params = array();
                 if ($b_category) {
                     $params['sCategory'] = $category;
                 }
                 if ($b_city) {
                     //print_r("~~~~~~~~~~~~~~~~~~~".$city."~~~~~~~~~~~~~~~~~~~~");
                     $aCity = City::newInstance()->findByName($city);
                     if (count($aCity) == 0) {
                         $params['sCity'] = $city;
                         $l = array('url' => osc_search_url($params), 'title' => $city);
                         $this->addLevel($l);
                     } else {
                         $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']);
                         $params['sRegion'] = $aRegion['s_name'];
                         $l = array('url' => osc_search_url($params), 'title' => $aRegion['s_name']);
                         $this->addLevel($l);
                         $params['sCity'] = $aCity['s_name'];
                         $l = array('url' => osc_search_url($params), 'title' => $aCity['s_name']);
                         $this->addLevel($l);
                     }
                 } else {
                     if ($b_region) {
                         $params['sRegion'] = $region;
                         $l = array('url' => osc_search_url($params), 'title' => $region);
                         $this->addLevel($l);
                     }
                 }
             }
             // pattern
             if ($b_pattern) {
                 $l = array('title' => sprintf($this->title['search_pattern'], $pattern));
                 $this->addLevel($l);
             }
             // remove url from the last node
             $nodes = $this->getaLevel();
             if ($nodes > 0) {
                 if (array_key_exists('url', $nodes[count($nodes) - 1])) {
                     unset($nodes[count($nodes) - 1]['url']);
                 }
             }
             $this->setaLevel($nodes);
             break;
         case 'user':
             // use dashboard without url if you're in the dashboards
             if ($this->getSection() == 'dashboard') {
                 $l = array('title' => $this->title['user_dashboard']);
                 $this->addLevel($l);
                 break;
             }
             // use dashboard without url if you're in the dashboards
             if ($this->getSection() == 'pub_profile') {
                 $l = array('title' => sprintf($this->title['user_dashboard_profile'], osc_user_name()));
                 $this->addLevel($l);
                 break;
             }
             $l = array('url' => osc_user_dashboard_url(), 'title' => $this->title['user_account']);
             $this->addLevel($l);
             switch ($this->getSection()) {
                 case 'items':
                     $l = array('title' => $this->title['user_items']);
                     $this->addLevel($l);
                     break;
                 case 'alerts':
                     $l = array('title' => $this->title['user_alerts']);
                     $this->addLevel($l);
                     break;
                 case 'profile':
                     $l = array('title' => $this->title['user_profile']);
                     $this->addLevel($l);
                     break;
                 case 'change_email':
                     $l = array('title' => $this->title['user_change_email']);
                     $this->addLevel($l);
                     break;
                 case 'change_password':
                     $l = array('title' => $this->title['user_change_password']);
                     $this->addLevel($l);
                     break;
                 case 'change_username':
                     $l = array('title' => $this->title['user_change_username']);
                     $this->addLevel($l);
                     break;
             }
             break;
         case 'login':
             switch ($this->getSection()) {
                 case 'recover':
                     $l = array('title' => $this->title['login_recover']);
                     $this->addLevel($l);
                     break;
                 case 'forgot':
                     $l = array('title' => $this->title['login_forgot']);
                     $this->addLevel($l);
                     break;
                 case '':
                     $l = array('title' => $this->title['login']);
                     $this->addLevel($l);
                     break;
             }
             break;
         case 'register':
             $l = array('title' => $this->title['register']);
             $this->addLevel($l);
             break;
         case 'page':
             $l = array('title' => osc_static_page_title());
             $this->addLevel($l);
             break;
         case 'contact':
             $l = array('title' => $this->title['contact']);
             $this->addLevel($l);
             break;
     }
 }