Ejemplo n.º 1
0
setvar("CompanynewsTypes", $_PB_CACHE['companynewstype']);
if (isset($company_id)) {
    $conditions = "company_id=" . $company_id;
}
if (!$company->Validate($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "edit") {
        $company->newCheckStatus($companyinfo['status']);
        if (!empty($id)) {
            $res = $companynews->read("Companynews.id AS ID,title AS Title,content AS Content,type_id,created AS CreateDate", $id);
            setvar("item", $res);
            setvar("ShowCaption", "none");
        }
        $tpl_file = "news_edit";
        vtemplate($tpl_file);
        exit;
    }
}
if (isset($_POST['save'])) {
    pb_submit_check('title');
    $vals = null;
    $vals['title'] = trim($_POST['title']);
    $vals['content'] = trim($_POST['content']);
    $vals['type_id'] = $_POST['type_id'];
    $now_companynews_amount = $companynews->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid);
Ejemplo n.º 2
0
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
if (!defined('IN_PHPB2B')) {
    exit('Not A Valid Entry Point');
}
uses("companynews");
$companynews = new Companynewses();
$conditions = "Companynews.status='1' And Companynews.company_id=" . $company->info['id'];
if (isset($_GET['nid'])) {
    $id = intval($_GET['nid']);
    if ($id) {
        $info = $companynews->read("*", $id, null, $conditions);
        if (empty($info)) {
            flash('data_not_exists', null, 0);
        }
        $tpl_file = "news_detail";
        setvar("item", $info);
        $space->render($tpl_file);
        exit;
    }
}
$amount = $companynews->findCount(null, $conditions, "Companynews.id");
setvar("paging", array('total' => $amount));
$space->render("news");