Exemplo n.º 1
0
        unset($vals['created']);
        $companynews->save($vals, "update", $_POST['newsid'], null, "member_id=" . $the_memberid);
        pheader("location:news.php?action=list");
    } else {
        if ($g['max_companynews'] && $now_companynews_amount >= $g['max_companynews']) {
            flash('one_day_max');
        }
        $vals['created'] = $time_stamp;
        $vals['member_id'] = $the_memberid;
        $vals['company_id'] = $company_id;
        $result = $companynews->save($vals);
        flash($msg);
    }
}
if (isset($_POST['del'])) {
    $result = $companynews->del($_POST['newsid'], $conditions);
    if ($result) {
        flash("success");
    } else {
        flash("action_failed");
    }
}
$amount = $companynews->findCount(null, $conditions);
$page->setPagenav($amount);
$fields = "title as CompanynewsTitle,status,created,type_id,id as CompanynewsId";
$result = $companynews->findAll($fields, null, $conditions, "id DESC", $page->firstcount, $page->displaypg);
setvar("CheckStatus", $G['typeoption']["check_status"]);
for ($i = 0; $i < count($result); $i++) {
    $result[$i]['pubdate'] = df($result[$i]['created']);
}
setvar("Items", $result);
Exemplo n.º 2
0
 *
 *      @version $Revision: 2163 $
 */
require "../libraries/common.inc.php";
uses("companynews", "company", "member");
require PHPB2B_ROOT . 'libraries/page.class.php';
require "session_cp.inc.php";
$member = new Members();
$page = new Pages();
$company = new Companies();
$companynews = new Companynewses();
$conditions = $joins = array();
$tpl_file = "companynews";
$common_status = cache_read("typeoption", "common_status");
if (isset($_POST['del']) && is_array($_POST['id'])) {
    if (!$companynews->del($_POST['id'])) {
        flash();
    }
}
if (isset($_POST['check']) && !empty($_POST['id']) && is_array($_POST['id'])) {
    $strCompanyNewsId = implode(",", $_POST['id']);
    $strCompanyNewsId = "(" . $strCompanyNewsId . ")";
    $arrResult = $pdb->GetArray("select id,status from " . $companynews->getTable() . " where id in " . $strCompanyNewsId);
    if (!empty($arrResult)) {
        foreach ($arrResult as $key => $val) {
            if (1 == $val['status']) {
                $result = $pdb->Execute("update " . $companynews->getTable() . " set status='0' where id=" . $val['id']);
            } else {
                $result = $pdb->Execute("update " . $companynews->getTable() . " set status='1' where id=" . $val['id']);
            }
        }