Beispiel #1
0
    function create($p_entry_id, $p_user_id, $p_user_name, $p_user_email, $p_title=null, $p_content=null, $p_mood_id=null)
    {
		// Create the record
		$values = array(
		  'fk_entry_id'   => $p_entry_id,
		  'fk_blog_id'    => BlogEntry::GetBlogId($p_entry_id),
		  'fk_language_id'=> BlogEntry::GetEntryLanguageId($p_entry_id),
		  'fk_user_id'    => $p_user_id,
		  'user_name'     => $p_user_name,
		  'user_email'    => $p_user_email,
		  'title'         => $p_title,
		  'content'       => $p_content,
		  'fk_mood_id'    => $p_mood_id,
		  'date'     => date('Y-m-d H:i:s')
		);

		$success = parent::create($values);

		if (!$success) {
			return false;
		}

		// set proper status/adminstatus if blog is not moderated
        // DB default is pending
        if ($this->getBlog()->getProperty('admin_status') == 'online') {
            $this->setProperty('admin_status', 'online');
        }
        if ($this->getBlog()->getProperty('status') == 'online') {
            $this->setProperty('status', 'online');
        }

		$this->fetch();
        $CampCache = CampCache::singleton();
        $CampCache->clear('user');
        return true;
    }