Example #1
0
function module_advert_edit()
{
    global $global, $smarty;
    $obj = new advert();
    $obj->set_where('adv_id = ' . $global['id']);
    $smarty->assign('advert', $obj->get_one());
}
Example #2
0
function module_ad($par)
{
    global $smarty;
    $obj = new advert();
    $obj->set_where('adv_id = ' . $par['id']);
    $one = $obj->get_one();
    $ad = '';
    if (count($one)) {
        $ad = str_replace(''', chr(39), $one['adv_code']);
    }
    $smarty->assign('ad', $ad);
}
Example #3
0
function add_or_edit_advert()
{
    global $smarty, $lang;
    $adv_id = post('adv_id');
    $adv_name = post('adv_name');
    $adv_code = post('adv_code', 'loose');
    $obj = new advert();
    $obj->set_value('adv_name', $adv_name);
    $obj->set_value('adv_code', $adv_code);
    if ($adv_id != '') {
        $obj->set_where("adv_id = {$adv_id}");
        $obj->edit();
        $info_text = '修改广告成功';
    } else {
        $obj->add();
        $info_text = '添加广告成功';
    }
    $smarty->assign('info_text', $info_text);
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'basic', 'mod' => 'advert_list')));
}
 public function mangeAdvertAction(advert $advert)
 {
     $user = $this->getUser();
     if (!is_object($user) || !$user instanceof User) {
         throw new AccessDeniedException("Vous devez etre identifié pour acceder à cette zone");
     }
     if ($advert->getUser() != $user) {
         throw new AccessDeniedException("Vous n'avez rien à faire ici, ce n'est pas votre annonce - Bon message à revoir, je sais");
     }
     $advertManager = $this->getAdvertManager();
     // Génération du breadcrumb
     $breadcrumb = array(array('Dashboard', $this->generateUrl('snoozit_dashboard_homepage')), array('Mes annonces', $this->generateUrl('snoozit_dashboard_user_advert')), array($advert->getTitle(), '#', true));
     return $this->render('SnoozitPlatformBundle:DashBoard/Manager:manager.html.twig', array('breadcrumb' => $breadcrumb, 'interest' => $advert->getInterested(), 'negoces' => $advert->getNegoces(), 'comments' => $advert->getComments(), 'advert' => $advert));
 }
Example #5
0
function module_advert_list()
{
    global $smarty;
    $obj = new advert();
    $smarty->assign('advert', $obj->get_list());
}