コード例 #1
0
ファイル: actions.class.php プロジェクト: solutema/siwapp-sf1
 private function render($model = 'Invoice', $pdf = false)
 {
     sfConfig::set('sf_web_debug', false);
     $template = TemplateTable::getTemplateForModel($model);
     $printer = new Printer($model, $template->getId());
     $data = $this->getInvoiceDataFromRequest($this->getRequest());
     return $pdf ? $printer->renderPdf($data) : $printer->render($data);
 }
コード例 #2
0
ファイル: EmailMessages.php プロジェクト: solutema/siwapp-sf1
 public function __construct($invoice)
 {
     parent::__construct();
     $this->setTo($invoice->customer_email, $invoice->customer_name);
     // To get all the properties loaded for the template
     foreach ($invoice->Items as $it) {
         $it->refreshRelated();
     }
     $data[] = $invoice;
     $model = get_class($invoice);
     $printer = new Printer($model, TemplateTable::getTemplateForModel($model)->getId());
     try {
         $body = $printer->render($data);
         $pdf = $printer->renderPdf($data)->output();
         $attachment = new Swift_Attachment($pdf, $model . '-' . $invoice->getId() . '.pdf', 'application/pdf');
         $this->setSubject(PropertyTable::get('company_name') . ' [' . $model . ': ' . $invoice . ']')->setBody($printer->render($data), 'text/html')->attach($attachment);
         $this->setReadyState(true);
     } catch (LogicException $e) {
         $this->setReadyState(false);
     }
 }
コード例 #3
0
 function deleteDBTemplate($shortName)
 {
     if ($this->editEnabled) {
         $tt = new TemplateTable($this->db);
         $to = $tt->getRowObject();
         $to->shortName = $shortName;
         if ($to->loadWhere("shortName='{$shortName}'")) {
             $to->delete();
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
コード例 #4
0
    require_once PATH_CORE . '/classes/cleanup.class.php';
    $cleanupObj = new cleanup($db, '');
    $cleanupObj->flushDatabase();
    echo 'Database cleansed<br />';
} else {
    // set up system status table
    // to do - move this to a dbrowobject model - and replace in facebook initdb too
    $manageObj->addTable("SystemStatus", "id", "INT(4) unsigned NOT NULL auto_increment", "MyISAM");
    $manageObj->addColumn("SystemStatus", "name", "VARCHAR(35) default ''");
    $manageObj->addColumn("SystemStatus", "strValue", "TEXT default ''");
    $manageObj->addColumn("SystemStatus", "numValue", "BIGINT(20) default 0");
    //////////////////////////////////////////////////////////////////////////////////////////
    // news-specific tables
    if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'dynamicTemplate.class.php')) {
        require_once PATH_CORE . '/classes/dynamicTemplate.class.php';
        TemplateTable::createTable($manageObj);
    }
    if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'user.class.php')) {
        // Create the User table
        require_once PATH_CORE . '/classes/user.class.php';
        UserTable::createTable($manageObj);
        UserInfoTable::createTable($manageObj);
        $userInfoTable = new UserInfoTable($manageObj->db);
        UserInviteTable::createTable($manageObj);
    }
    // set up newswire table
    $manageObj->addTable("Newswire", "id", "INT(11) unsigned NOT NULL auto_increment", "MyISAM");
    $manageObj->addColumn("Newswire", "title", "VARCHAR(255) default ''");
    $manageObj->addColumn("Newswire", "caption", "TEXT default ''");
    $manageObj->addColumn("Newswire", "source", "VARCHAR (150) default ''");
    $manageObj->addColumn("Newswire", "url", "VARCHAR(255) default ''");