当前位置: 首页>>代码示例>>PHP>>正文


PHP news::save方法代码示例

本文整理汇总了PHP中news::save方法的典型用法代码示例。如果您正苦于以下问题:PHP news::save方法的具体用法?PHP news::save怎么用?PHP news::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在news的用法示例。


在下文中一共展示了news::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convert

    /**
     * main routine to convert old school module data into new controller format
     * @global db the exponent database object
     * @param  $iloc
     * @param  $module
     * @param int $hc
     * @return
     */
    private function convert($iloc, $module, $hc = 0)
    {
        if (!array_key_exists($iloc->mod, $this->params['migrate'])) {
            return $module;
        }
        global $db;
        $old_db = $this->connect();
        $linked = false;
        $loc = null;
        switch ($iloc->mod) {
            case 'textmodule':
                @($module->view = 'showall');
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'textmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'textmodule';
                $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new text();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "text";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        $text->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'rotatormodule':
                $module->action = 'showRandom';
                $module->view = 'showRandom';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'rotatormodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'rotatormodule';
                $textitems = $old_db->selectObjects('rotator_item', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new text();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "text";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        $text->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'snippetmodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "snippet";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'snippetmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'snippetmodule';
                $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new snippet();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "snippet";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        // if the item exists in the current db, we won't save it
                        $te = $text->find('first', "location_data='" . $text->location_data . "'");
                        if (empty($te)) {
                            $text->save();
                            @$this->msg['migrated'][$iloc->mod]['count']++;
                            @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                        }
                    }
                }
                break;
            case 'linklistmodule':
                switch ($module->view) {
//.........这里部分代码省略.........
开发者ID:notzen,项目名称:exponent-cms,代码行数:101,代码来源:migrationController.php

示例2: studiengang

 if ($news->content_id == '') {
     $studiengang = new studiengang();
     $studiengang->load($_POST['studiengang_kz']);
     $content = new content();
     $content->template_kurzbz = 'news';
     $content->oe_kurzbz = $studiengang->oe_kurzbz;
     $content->aktiv = true;
     $content->menu_open = false;
     $content->insertamum = date('Y-m-d H:i:s');
     $content->insertvon = $uid;
     if (!$content->save(true)) {
         die($content->errormsg);
     }
     $news->content_id = $content->content_id;
 }
 if (!$news->save()) {
     die($news->errormsg);
 }
 $news_id = $news->news_id;
 //ContentSprache
 $sprachen = array(DEFAULT_LANGUAGE);
 foreach ($_POST as $key => $value) {
     if (mb_strstr($key, 'contentsprache_id_')) {
         $sprachen[] = mb_substr($key, strlen('contentsprache_id_'));
     }
 }
 $sprachen = array_unique($sprachen);
 foreach ($sprachen as $lang) {
     $content = new content();
     if (isset($_POST['sichtbar_' . $lang])) {
         $sichtbar = true;
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:31,代码来源:newsverwaltung.php

示例3: news

<?php

/*
 * This file is part of Infoschool - a web based school intranet.
 * Copyright (C) 2005 Maikel Linke
 */
include 'var.php';
$output->secure('admin');
$news = new news();
if (isset($_POST['news_data'])) {
    $data = $_POST['news_data'];
    $news->save($data);
    redirect('edit.php?news=' . $data['id']);
}
if (!isset($_GET['news'])) {
    redirect('./');
}
$news_id = (int) $_GET['news'];
$news->load($news_id);
$news->format();
$content = $news->tmpl();
$content .= $news->tmpl('form.html');
$output->out($content);
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:23,代码来源:edit.php


注:本文中的news::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。