Esempio n. 1
0
 public function executeBlogs()
 {
     $c = new Criteria();
     $c->addAscendingOrderByColumn(BlogPeer::NAME);
     $c->add(BlogPeer::APPROVED, true);
     $this->blogs = BlogPeer::doSelect($c);
 }
Esempio n. 2
0
 private function displayVerificationForm()
 {
     $c = new Criteria();
     $c->add(BlogPeer::VERIFIED, false);
     $c->addAscendingOrderByColumn(BlogPeer::NAME);
     $this->blogs = BlogPeer::doSelect($c);
     return 'Form';
 }
Esempio n. 3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(BlogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(BlogPeer::DATABASE_NAME);
         $criteria->add(BlogPeer::BLOG_ID, $pks, Criteria::IN);
         $objs = BlogPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 4
0
<?php

set_time_limit(0);
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('SF_APP', 'backend');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', false);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
$c = new Criteria();
$c->add(BlogPeer::VERIFIED, true);
$c->add(BlogPeer::APPROVED, false);
$blogs = BlogPeer::doSelect($c);
if (empty($blogs)) {
    return;
}
$mail = new sfMail();
$mail->initialize();
$mail->setMailer('sendmail');
$mail->setCharset('utf-8');
$mail->setSubject('Lista blogów do zatwierdzenia');
$mail->setSender('*****@*****.**', 'Planeta PHP.pl');
$mail->setFrom('*****@*****.**', 'Planeta PHP.pl');
$admins = AdminPeer::doSelect(new Criteria());
foreach ($admins as $admin) {
    $mail->addAddress($admin->getEmail());
}
$body = "Oto lista blogów, które pozostały do zawierdzenia:\n";
foreach ($blogs as $blog) {
    $body .= " - {$blog->getName()} ({$blog->getUrl()})\n";
Esempio n. 5
0
 public function getBlogs($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseBlogPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collBlogs === null) {
         if ($this->isNew()) {
             $this->collBlogs = array();
         } else {
             $criteria->add(BlogPeer::AUTHOR_ID, $this->getId());
             BlogPeer::addSelectColumns($criteria);
             $this->collBlogs = BlogPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(BlogPeer::AUTHOR_ID, $this->getId());
             BlogPeer::addSelectColumns($criteria);
             if (!isset($this->lastBlogCriteria) || !$this->lastBlogCriteria->equals($criteria)) {
                 $this->collBlogs = BlogPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastBlogCriteria = $criteria;
     return $this->collBlogs;
 }