function run()
 {
     $retVal = $this->init();
     if ($retVal) {
         $this->message("Running");
         // test isValid
         $c = new cIssue();
         //mydump($c,"Issue");
         $this->assert(!$c->save(), "isValid accepted default values");
         $c->title = "Issue 1";
         $this->assert(!$c->save(), "isValid accepted name only");
         $c->newsletter_id = 15;
         $this->assert($c->isValid(), "hmmm... should have valid :( ");
         $this->assert($c->save(), "hmmm... should have saved :( ");
         // test if save works fine
         if (empty($c->id) || $c->id == 0) {
             $this->error("what the f.... should have saved and i have no IDea :(");
             $this->success = false;
             //check for email
         } else {
             // remember id and clear object
             $myid = $c->getID();
             $c = 0;
             // reread and check values
             $c = new cIssue($myid);
             $this->assert($c->newsletter_id == 15, 'domain_id is not equal after save');
             $this->assert($c->title == "Issue 1", 'name is not equal after save');
             //delete record
             //$this->assert($c->delete(),"hmmm... should have deleted :( ");
         }
     }
     return $retVal;
 }
Ejemplo n.º 2
0
 /**
  * @author sepo
  * @abstract
  * @return array all issues related to this newsletter
  */
 function getIssues()
 {
     if (empty($this->_issues) || !is_array($this->_issues)) {
         $this->_issues = array();
         if ($rs = executeQuery("SELECT * FROM issue WHERE newsletter_id='" . $this->getID() . "' ORDER BY mode, delivery, changed")) {
             while ($row = $rs->getrow()) {
                 $issue = new cIssue();
                 $issue->set($row);
                 $this->_issues[] = $issue;
             }
         }
     }
     return $this->_issues;
 }
require_once dirname(__FILE__) . '/inc.classes.php';
if (!isset($data)) {
    $data = array('headline' => 'Content', 'body' => 'Here you can view, edit, copy and delete your existing contents, or add new content to the topic.', 'tablehead' => array('News', 'Text'), 'link' => array("edit" => "#", "new" => "#", "detail" => "#", 'delete' => '#', 'copy' => '#', 'save' => '#'));
}
$where = '';
if (isset($issue_id)) {
    $where .= " WHERE issue_id='" . $issue_id . "'";
}
if (isset($topic_id)) {
    $where .= " AND topic_id='" . $topic_id . "'";
}
// set num results to total of news and teaser entries
$GLOBALS['num_results'] = countQuery("SELECT id FROM " . $SQLTable['content'] . $where);
$GLOBALS['max_results_per_page'] = 200;
if (isset($issue_id)) {
    $issue = new cIssue($issue_id);
    $nl = $issue->getNewsletter();
    $tm = new xoxNewsletterTheme($nl->template_html);
    $first = true;
    $all_subs = array();
    foreach ($tm->sub_name as $sub => $name) {
        $data['tablehead'] = array($name, 'Text');
        $sqls = "SELECT id,  title, body FROM " . $SQLTable['content'] . $where . " AND flags='" . $sub . "' ORDER BY displayorder";
        $data['data'] = $sqls;
        $data['buttons'] = 15;
        $data['sort'] = $sub;
        echo drawList($data, $first);
        $first = false;
        $all_subs[] = $sub;
    }
} else {