Example #1
0
File: Lists.php Project: kotow/work
 public static function getListByListId($listid)
 {
     try {
         $c = new Criteria();
         $c->add(ListsPeer::LIST_ID, $listid);
         $list = ListsPeer::doSelectOne($c);
         return $list;
     } catch (Exception $e) {
         return false;
     }
 }
Example #2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ListsPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setLabel($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setListId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setListType($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCreatedAt($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setUpdatedAt($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setPublicationStatus($arr[$keys[6]]);
     }
 }
Example #3
0
 public static function lists_search(&$c, &$pager)
 {
     self::getSearchParams($context, $user, $request, $keys, $stype);
     $pager = "Lists";
     $c->add(ListsPeer::LABEL, $keys, Criteria::LIKE);
     $res = ListsPeer::doSelect($c);
     $c = new Criteria();
     $c->add(ListitemI18nPeer::LABEL, keys, Criteria::LIKE);
     $res2 = ListitemI18nPeer::doSelect($c);
     $c = new Criteria();
     $c->add(ListitemPeer::LABEL, $keys, Criteria::LIKE);
     $res3 = ListitemPeer::doSelect($c);
     $c = array_merge($res, array_merge($res2, $res3));
 }
Example #4
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(ListsPeer::ID, $pks, Criteria::IN);
         $objs = ListsPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #5
0
function InitData($project_name)
{
    $listPageType = 'list_types';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $listPageType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'list_type'...\n";
        $newList = new Lists();
        $newList->setLabel('List Types');
        $newList->setListid($listPageType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('System list');
        $newItem->setValue('system');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Static list');
        $newItem->setValue('static');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editable list');
        $newItem->setValue('editable');
        $newItem->save(null, $newList);
    }
    $listPageType = 'page_types';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $listPageType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'page_types'...\n";
        $newList = new Lists();
        $newList->setLabel('Page Types');
        $newList->setListid($listPageType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('Content page');
        $newItem->setValue('CONTENT');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Page reference');
        $newItem->setValue('REFERENCE');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('External page');
        $newItem->setValue('EXTERNAL');
        $newItem->save(null, $newList);
    }
    $cultureType = 'culture';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $cultureType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'culture'...\n";
        $newList = new Lists();
        $newList->setLabel('Culture');
        $newList->setListid($cultureType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('english');
        $newItem->setValue('en');
        $newItem->save(null, $newList);
        /*		$newItem = new Listitem();
        		$newItem->setLabel('български');
        		$newItem->setValue('bg');
        		$newItem->save(null, $newList);*/
    }
    $userType = 'usertype';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $userType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'user types'...\n";
        $newList = new Lists();
        $newList->setLabel('User Types');
        $newList->setListid($userType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('Administrator (all rights)');
        $newItem->setValue('admin');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editor (no access to administration modules)');
        $newItem->setValue('editor');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editor (edit and save existing items)');
        $newItem->setValue('restricted_editor');
        $newItem->save(null, $newList);
    }
    $Mailinglist_Folder = Document::getDocumentByExclusiveTag('newsletter_folder_mailinglist');
    if (!$Mailinglist_Folder) {
        $Newsletter_Root = Rootfolder::getRootfolderByModule('Newsletter');
        $Mailinglist_Folder = new Folder();
        $Mailinglist_Folder->setLabel('Mailing lists');
        $Mailinglist_Folder->save(null, $Newsletter_Root);
        Document::addTag($Mailinglist_Folder, 'newsletter_folder_mailinglist');
    }
    $def_site = Document::getDocumentByExclusiveTag('website_website_default');
    if (!$def_site) {
        $website_root = Rootfolder::getRootfolderByModule('Website');
        $def_site = new Website();
        $def_site->setLabel(UtilsHelper::mb_ucfirst($project_name));
        $def_site->save(null, $website_root);
        Document::addTag($def_site, 'website_website_default');
    }
    $homePage = Document::getDocumentByExclusiveTag('website_page_home');
    if (!$homePage) {
        $homePage = new Page();
        $homePage->setLabel('Home');
        $homePage->setPageType('CONTENT');
        $homePage->setNavigationTitle('Home');
        $homePage->setTemplate('default');
        $homePage->save(null, $def_site);
        Document::addTag($homePage, 'website_page_home');
    }
}