public static function getContactPage()
 {
     $page = PageTable::getInstance()->findOneByUrl('contact');
     if (null === $page) {
         throw new LogicException(__CLASS__ . ': Contact page not found');
     }
     return $page;
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $pages = PageTable::getInstance()->findAll();
     foreach ($pages as $page) {
         $commit = CommitTable::getLatestCommit($page->getId());
         $page->setLastUpdatedYm((int) $commit->getDateTimeObject('committed_at')->format('Ym'));
         $page->save();
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $pages = PageTable::getInstance()->findAll();
     foreach ($pages as $page) {
         $commit = CommitTable::getFirstCommit($page->getId());
         $page->setFirstCommitted($commit->getCommittedAt());
         $page->save();
     }
 }
 /**
  * pageActions::executePage_index()
  *
  * @param sfWebRequest $request
  * @return
  */
 public function executePage_index(sfWebRequest $request)
 {
     // リクエストされたパスを取得する。
     $path = strtolower($request->getPathInfo());
     //  並べ替えパラメータを取得する。
     $sort_key = $request->getParameter('sk', 'title');
     $sort_order = $request->getParameter('so', 'asc');
     // パスにマッチするページ一覧を取得する。
     $pages = PageTable::getListFromPath($path, $sort_key, $sort_order);
     $this->path = $path;
     $this->pages = $pages;
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     // リクエストされたパスを取得する。
     $path = strtolower($request->getPathInfo());
     $year = $request->getParameter('year', '');
     $month = $request->getParameter('month', '');
     $page_type = $request->getParameter('page_type', '');
     $path = str_replace(sprintf('%s/%s/', $year, $month), '', $path);
     //  並べ替えパラメータを設定する。
     $sort_key = 'first_committed';
     $sort_order = 'desc';
     // パスと条件にマッチするページ一覧を取得する。
     $pages = PageTable::getListFromPath($path, $sort_key, $sort_order, -1, true, $year, $month);
     // パスにマッチするページ一覧(全部)を取得する。
     $pages_temp = PageTable::getListFromPath($path, $sort_key, $sort_order);
     // ページの一覧から年月インデックス配列を作成する。
     $ym_index = array();
     foreach ($pages_temp as $page) {
         $ym = $page->getDateTimeObject('first_committed')->format('Ym');
         if (isset($ym_index[$ym])) {
             ++$ym_index[$ym]['count'];
         } else {
             $ym_index[$ym]['count'] = 1;
             $ym_index[$ym]['year'] = substr($ym, 0, 4);
             $ym_index[$ym]['month'] = substr($ym, -2, 2);
         }
     }
     $this->path = $path;
     $this->pages = $pages;
     $this->ym_index = $ym_index;
     switch ($page_type) {
         case 'events':
             $title = 'イベント';
             break;
         case 'news':
             $title = 'ニュース';
             break;
         case 'blog':
         default:
             $title = 'ブログ';
             break;
     }
     $this->page_type = $page_type;
     $this->page_title = $title;
 }
Exemple #6
0
    $sql->container = "on";
    $sql->variable = "on";
    $sql->module = 'product';
    $sql->action = 'search';
    $sql->lang = LC_LANG;
}
if (isset($x)) {
    $abfrage = $sql->where("x", 1);
    $from = 0;
}
$tpl->setVariable("UEBERSCHRIFT", $lang->translate('productsearch'));
$content["ABFRAGEBOX"] = $sql->form("x", $searchable_fields, "searchbox", url(array('module' => 'product', 'action' => 'search')));
if (!isset($order)) {
    $order = "name";
}
if ($abfrage) {
    require_once 'mms_tablepager.php';
    $table['firma'] = $cfg['table']['company'];
    $table['produkt'] = $cfg['table']['product'];
    $table['produktkat'] = $cfg['table']['cat_product'];
    $tabpage = new PageTable($cfg['database']['dsn'], "overview");
    $tabpage->url_view = url(array('module' => 'product', 'action' => 'details'));
    // echo $abfrage;
    // $abfrage=urldecode($abfrage);
    $tabpage->url = url(array('module' => 'product', 'action' => 'search', 'abfrage' => urlencode($abfrage)));
    $tabpage->fields = $fields;
    $tabpage->map_cols = $map_cols;
    $tabpage->indexcol = 'produktid';
    $query = "SELECT *,{$table['produkt']}.id as produktid, {$table['produkt']}.name as produktname,  t_manufacturer.name as herstellername\n                FROM\n                        {$table['produkt']}, {$table['produktkat']},{$table['firma']} as t_manufacturer\n                WHERE\n                        {$table['produkt']}.id_produktkat={$table['produktkat']}.id\n                        AND {$table['produkt']}.id_hersteller=t_manufacturer.id\n\n                         AND " . stripslashes($abfrage);
    $tpl->setVariable("TABELLE", $tabpage->get($query, $from, 'overview'));
}
        $this->HTML_Menu_browser($DSN, $table, $query);
    }
    function makeURL($eintrag)
    {
        $url = url(array('module' => 'product', 'action' => 'overview', 'id' => $eintrag['id']));
        return $url;
    }
}
$browser = new HTML_menu_browser_company($cfg['database']['dsn']);
$browser->setQuery("SELECT *, rc_produktkat.id as id, count(rc_produkt.id) as numchildren\n    FROM rc_produktkat LEFT JOIN rc_produkt ON (rc_produkt.id_produktkat=rc_produktkat.id)\n    GROUP BY rc_produktkat.id ORDER BY rc_produktkat.name_" . LC_LANG);
$browser->lang = LC_LANG;
$m = $browser->getMenu();
$table['product'] = $cfg['table']['product'];
$table['cat_product'] = $cfg['table']['cat_product'];
if (!$id) {
    $id = 0;
}
require_once 'mms_tablepager.php';
$tabpage = new PageTable($cfg['database']['dsn'], "overview");
$tabpage->make_url = false;
$tabpage->fields = array('name');
$tabpage->col_view = 'name';
$tabpage->url_view = url(array('module' => 'product', 'action' => 'details'));
$tabpage->add_extra = false;
$query = "select name_" . LC_LANG . " from {$table['cat_product']} where id = {$id} ORDER BY name_" . LC_LANG;
$str_category = $db_con->getOne($query);
$query = "select* from {$table['product']}\n             where id_produktkat={$id} order by name asc";
$prod_menu = new mms_template_Menu($m, 'yahoo', "REQUEST_URI");
$prod_menu->keepEmpty = false;
$prod_menu->shownumchildren = true;
$content['CONTENT'] .= "<h1>" . $str_category . "</h1>" . $prod_menu->get('urhere') . '<br>' . $prod_menu->get('yahoo') . '<br><hr>' . $tabpage->get($query, $from, 'overview');
$t->ok(PageTable::getRenderer('html') instanceof HtmlRenderer, 'レンダラーの取得(HTML)');
$t->ok(PageTable::getRenderer('') instanceof MarkdownRenderer, 'レンダラーの取得(デフォルト=Markdown)');
// checkType()
$t->diag('checkType()');
$t->is(PageTable::checkType('test.markdown'), 'markdown', 'タイプ:マークダウン');
$t->is(PageTable::checkType('test.md'), 'markdown', 'タイプ:マークダウン');
$t->is(PageTable::checkType('test.mkd'), 'markdown', 'タイプ:マークダウン');
$t->is(PageTable::checkType('test.mdown'), 'markdown', 'タイプ:マークダウン');
$t->is(PageTable::checkType('test.mkdn'), 'markdown', 'タイプ:マークダウン');
$t->is(PageTable::checkType('test.html'), 'html', 'タイプ:HTML');
$t->is(PageTable::checkType('test'), 'markdown', 'タイプ:空の場合はマークダウン');
$t->is(PageTable::checkType('test.txt'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.xml'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.gif'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.jpg'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.png'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.js'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.css'), false, '未対応タイプ');
$t->is(PageTable::checkType('test.php'), false, '未対応タイプ');
// needProcess()
$t->diag('needProcess()');
$t->is(PageTable::needProcess('test.markdown'), true, 'markdown 要');
$t->is(PageTable::needProcess('test.html'), true, 'html 要');
$t->is(PageTable::needProcess('test'), true, '拡張子なし 要');
$t->is(PageTable::needProcess('test.png'), false, 'png 不要');
$t->is(PageTable::needProcess('test.jpg'), false, 'jpg 不要');
$t->is(PageTable::needProcess('test.gif'), false, 'gif 不要');
$t->is(PageTable::needProcess('test.js'), false, 'js 不要');
$t->is(PageTable::needProcess('test.css'), false, 'css 不要');
$t->is(PageTable::needProcess('test.php'), false, 'php 不要');
 /**
  * SyncRepositoryTask::execute()
  *
  * @param array $arguments
  * @param array $options
  * @return
  */
 protected function execute($arguments = array(), $options = array())
 {
     // ログファイルの設定
     $file_logger = new sfFileLogger($this->dispatcher, array('file' => $this->configuration->getRootDir() . '/log/' . $this->getName() . '.log'));
     $this->dispatcher->connect('application.log', array($file_logger, 'listenToLogEvent'));
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // 更新フラグのあるリポジトリの最初の1件を取得する。
     $repository = RepositoryTable::getInstance()->findOneByForceUpdate(1);
     if (!$repository) {
         return false;
     }
     // 更新フラグを消しておく。
     $repository->setForceUpdate(0);
     $repository->save();
     // リポジトリを同期する。
     $this->log(sprintf('リポジトリ %s の同期を開始します', $repository->getRepositoryName()));
     // リポジトリキャッシュルートディレクトリ
     $cache_root = sfConfig::get('sf_root_dir') . '/../data/repos/';
     $dir_root = $cache_root . $repository->getCacheKey();
     $do_clone = false;
     if ($repository->getForceClone()) {
         // 一旦このディレクトリ配下をすべて削除する
         sfToolkit::clearDirectory($dir_root_repo);
         // 強制clone
         $do_clone = true;
     } else {
         if (!is_dir($dir_root)) {
             // ディレクトリがない。
             mkdir($dir_root, 0777, true);
             // このディレクトリ配下にcloneを取得する。
             $do_clone = true;
         } else {
             // リポジトリは取得済か?
             $dir_root_repo = $dir_root . DIRECTORY_SEPARATOR . $repository->getRepositoryName();
             try {
                 $git = new myVersionControl_Git($dir_root_repo);
                 $git->setGitCommandPath('git');
                 // pullする。
                 $this->log('リポジトリをpullしています');
                 $pullMessage = $git->getCommand('pull')->execute();
                 if (preg_match('/up\\-to\\-date/i', $pullMessage)) {
                     $this->log('更新はありません');
                     return;
                 }
             } catch (Exception $e) {
                 // 一旦このディレクトリ配下をすべて削除する
                 sfToolkit::clearDirectory($dir_root_repo);
                 // cloneする
                 $do_clone = true;
             }
         }
     }
     if ($do_clone) {
         $this->log('リポジトリをcloneしています');
         $git = new myVersionControl_Git($dir_root);
         $git->setGitCommandPath('git');
         $git->createClone($repository->getRepository());
         // リポジトリ
         $dir_root_repo = $dir_root . DIRECTORY_SEPARATOR . $repository->getRepositoryName();
         try {
             $git = new myVersionControl_Git($dir_root_repo);
             $git->setGitCommandPath('git');
         } catch (Exception $e) {
             // 一旦このディレクトリ配下をすべて削除する
             sfToolkit::clearDirectory($dir_root_repo);
             return;
         }
     }
     // このリポジトリの対象ファイルリストを取得する。
     $files = sfFinder::type('file')->prune('.git')->discard('.git')->relative()->in($search_dir = $dir_root . DIRECTORY_SEPARATOR . $repository->getRepositoryName() . $repository->getSubdirectory());
     $page_path_root = $repository->getBindPath();
     // ---------------------------------------------
     // ファイル別に処理
     $new_commit_found = false;
     foreach ($files as $file) {
         $this->log(sprintf('ファイル:%s', $file));
         $info = pathinfo($file);
         $file_path = $search_dir . DIRECTORY_SEPARATOR . $file;
         // ファイルの更新タイムスタンプが新しいものだけ処理する
         if (filemtime($file_path) < time() - 86400) {
             $this->log('更新なし');
             continue;
         }
         //  このファイルが対象かどうかチェックする。
         if (!PageTable::needProcess($file)) {
             $this->log('ページ取り込み対象外');
             // 画像データなら、パブリックディレクトリにコピーする。
             if (preg_match('/^(png|jpg|gif)$/', $info['extension'])) {
                 $target_path = $repository->getImagePublicPath($file);
                 $target_dir = dirname($target_path);
                 if (!is_dir($target_dir)) {
                     mkdir($target_dir, 0777, true);
                 }
                 $this->log('ファイルをパブリックディレクトリにコピーします。');
                 copy($file_path, $target_path);
                 chmod($target_path, 0666);
             }
             continue;
         }
         //  各ページに対応するURLパスを求める。
         if ('.' !== $info['dirname']) {
             $page_path = strtolower($page_path_root . '/' . $info['dirname'] . '/' . $info['filename']);
         } else {
             $page_path = strtolower($page_path_root . '/' . $info['filename']);
         }
         // ページに対応するレコードを取得する。
         $page = Doctrine_Core::getTable('Page')->findOneByPath($page_path);
         if (!$page) {
             $page = new Page();
             $page->setPath($page_path);
             $page->setRepository($repository);
         }
         echo $file;
         // ページごとにコミット履歴を取得する。
         $commits = $git->getCommits('master', $file_path);
         foreach ($commits as $commit) {
             // 既存ページの場合はコミットがすでに取り込み済かチェックする。
             $commit_record = null;
             if (!$page->isNew()) {
                 $commit_record = Doctrine_Core::getTable('Commit')->findOneByCommitKeyAndPageId($commit->__toString(), $page->getId());
             }
             if (!$commit_record) {
                 // コミットを登録する。
                 $new_commit_found = true;
                 $this->log(sprintf('コミット %s を取得しています', $commit));
                 $commit_record = new Commit();
                 $commit_record->setAuthorHandle($commit->getAuthorHandle());
                 $commit_record->setAuthorEmail($commit->getAuthorEmail());
                 $commit_record->setCommitterHandle($commit->getCommitterHandle());
                 $commit_record->setCommitterEmail($commit->getCommitterEmail());
                 $commit_record->setCommittedAt(date('Y/m/d H:i:s', $commit->getCommittedAt()));
                 $commit_record->setCommitKey($commit);
                 $commit_record->setPage($page);
                 $commit_record->save();
                 $commit_record->free();
                 unset($commit_record);
             }
         }
         //  新規のコミットが無い場合は、処理をスキップする。
         if (!$new_commit_found) {
             continue;
         }
         $new_commit_found = true;
         $page->setContentType($type = PageTable::checkType($file));
         $content = file_get_contents($file_path);
         if ('UTF-8' !== ($encoding = mb_detect_encoding($content))) {
             $content = mb_convert_encoding($content, 'UTF-8', $encoding);
         }
         $page->setContentRaw($content);
         // ページのレンダリングモードに合わせてレンダリングする。
         $page->setContentRendered($rendered = PageTable::renderContent($content, $type));
         // DOMパース用に、特殊文字を置換する。
         $html = mb_convert_encoding($rendered, 'HTML-ENTITIES', 'ASCII, JIS, UTF-8, EUC-JP, SJIS');
         // レンダリング結果をパースする。
         $dom = new DomDocument();
         $dom->loadHTML($html);
         $xpath = new DOMXPath($dom);
         // タイトルを探す。
         $domElements = $xpath->query('//title | //h1');
         if (count($domElements)) {
             $page->setTitle($domElements->item(0)->nodeValue);
         }
         // 見出しをパースする
         $domElements = $xpath->query('//h1 | //h2 | //h3');
         $indexes = array();
         $now_h1 = array();
         $now_h2 = array();
         foreach ($domElements as $domElement) {
             switch ($domElement->nodeName) {
                 case 'h1':
                     $indexes[] = array('type' => 'h1', 'text' => $domElement->nodeValue, 'id' => $domElement->getAttribute('id'), 'children' => array());
                     $now_h1 =& $indexes[count($indexes) - 1]['children'];
                     break;
                 case 'h2':
                     $now_h1[] = array('type' => 'h2', 'text' => $domElement->nodeValue, 'id' => $domElement->getAttribute('id'), 'children' => array());
                     $now_h2 =& $now_h1[count($now_h1) - 1]['children'];
                     break;
                 case 'h3':
                     $now_h2[] = array('type' => 'h3', 'text' => $domElement->nodeValue, 'id' => $domElement->getAttribute('id'), 'children' => array());
                     break;
                 default:
                     break;
             }
         }
         $page->setIndexJson(json_encode($indexes));
         // 保存する。
         $page->save();
         $page->free();
         unset($page);
     }
     // 新しいコミットがあった場合、キャッシュを削除する。
     if ($new_commit_found) {
         $frontend_cache_dir = sfConfig::get('sf_cache_dir') . '/frontend/prod/template';
         $cache = new sfFileCache(array('cache_dir' => $frontend_cache_dir));
         $cache->clean();
     }
     $this->log(sprintf('リポジトリ %s の同期が完了しました', $repository->getRepositoryName()));
 }
Exemple #10
0
$tbl->addRow(array($lang->translate('website'), $row->product_url));
$tbl->setColAttributes(0, 'width="100"');
$tbl->setColAttributes(1, 'width="300"');
$row1Style = array('class' => 'overview');
$row2Style = array('class' => 'overviewalternate');
$tbl->altRowAttributes(0, $row1Style, $row2Style);
$tpl->setVariable("UEBERSCHRIFT", $row->product_name);
$tpl->SetVariable("TABELLE_UEBERSCHRIFT", $row->product_name . " (" . $link_back . ")");
/** BEGIN Vertrieb **/
$query = "select *,t_reseller.name as reseller\n        from {$table['product']},{$table['company']} as t_reseller, {$table['reseller']}\n        where {$table['product']}.id={$id}\n        AND {$table['product']}.id={$table['reseller']}.id_produkt\n        AND {$table['reseller']}.id_firma=t_reseller.id";
require_once 'mms_tablepager.php';
$tabpage = new PageTable($cfg['database']['dsn'], "overview");
$tabpage->fields = array('name', 'land');
$tabpage->make_url = false;
$tabpage->add_extra = false;
$tabpage->col_view = 'name';
$tabpage->url_view = url(array('module' => 'company', 'action' => 'details'));
$res_vertrieb = '<h2>' . $lang->translate('reseller') . '</h2>' . $tabpage->get($query, $from, 'overview') . '<br>';
/** END Vertrieb **/
/** BEGIN Beispielmischungen **/
$query = "select *,{$table['compound']}.id as mixid, {$table['compound']}.name_" . LC_LANG . " as mischname from {$table['product']},{$table['compound_details']},{$table['compound']} where {$table['compound_details']}.id_produkt={$table['product']}.id AND {$table['compound']}.id = {$table['compound_details']}.id_mischung AND {$table['product']}.id={$id}";
$tabpage = new PageTable($cfg['database']['dsn'], "overview");
$tabpage->fields = array('mischname');
$tabpage->map_cols = array('mischname' => $lang->translate('compound'));
$tabpage->url_view = url(array('module' => 'compound', 'action' => 'details'));
$tabpage->setEmptyString($lang->translate('no compounds available for this product'));
$res_compound = '<h2>' . $lang->translate('compound') . '</h2>' . $tabpage->get($query, $from, 'overview');
/** END Beispielmischungen  **/
$tpl->setCurrentBlock("TABELLEBLOCK");
$tpl->setVariable("TABELLE", $tbl->toHTML() . $res_vertrieb . $res_compound);
$tpl->parseCurrentBlock();
Exemple #11
0
 public function executeContact()
 {
     // Get contact page content
     $this->page = PageTable::getContactPage();
 }
Exemple #12
0
class HTML_menu_browser_company extends HTML_menu_browser
{
    function HTML_menu_browser_company($DSN = '', $table = '', $query = "")
    {
        $this->HTML_Menu_browser($DSN, $table, $query);
    }
    function makeURL($eintrag)
    {
        $url = url(array('module' => 'infolinks', 'action' => 'overview', 'id' => $eintrag['id']));
        return $url;
    }
}
$browser = new HTML_menu_browser_company($cfg['database']['dsn']);
$browser->setQuery("SELECT *, rc_infolinkkat.id as id, count(rc_firma_produktkat.id_firma) as numchildren\nFROM rc_infolinkkat LEFT JOIN rc_firma_produktkat ON (rc_firma_produktkat.id_produktkat=rc_infolinkkat.id)\nGROUP BY rc_infolinkkat.id");
$m = $browser->getMenu();
$table['infolinks'] = $cfg['table']['infolinks'];
$table['firma'] = $cfg['table']['company'];
$table['firma_produktkat'] = $cfg['table']['company_cat_product'];
if (!$id) {
    $id = 0;
}
require_once 'mms_tablepager.php';
$tabpage = new PageTable($cfg['database']['dsn'], "overview");
$tabpage->fields = array('name');
$tabpage->url_view = url(array('module' => 'infolinks', 'action' => 'details'));
$query = "select*, {$table['firma']}.name as name from {$table['firma_produktkat']},{$table['firma']}\n             where {$table['firma_produktkat']}.id_produktkat={$id}\n             and {$table['firma_produktkat']}.id_firma = {$table['firma']}.id order by land asc";
$cmp_menu = new mms_template_Menu($m, 'tree', "REQUEST_URI");
$cmp_menu->keepEmpty = false;
$cmp_menu->shownumchildren = true;
$content['CONTENT'] .= '<h1>' . $cmp_menu->get('urhere') . '</h1>' . '<br>' . $cmp_menu->get('tree') . '<br>' . $tabpage->get($query, $from, 'overview');
//$nav->setMenu($cmp_menu->get('tree'));
Exemple #13
0
$t->is($page->getGithubUrl(), 'http://github.com/hidenorigoto/test/blob/master/bar.markdown', 'このページのgithub上のURLを取得する。');
$page2 = PageTable::getInstance()->findOneByPath('/foo/bar2');
$t->is($page2->getGithubUrl(), 'http://github.com/hidenorigoto/test/blob/master/bar2.html', 'このページのgithub上のURLを取得する。(ファイル名、タイプ加味)');
// getGithubHistoryUrl
$t->diag('getGithubHistoryUrl()');
$t->is($page->getGithubHistoryUrl(), 'http://github.com/hidenorigoto/test/commits/master/bar.markdown', 'このページのgithub上のコミット履歴のURLを取得する。');
// getFormattedFirstCommitted
$page = PageTable::getInstance()->findOneByPath('/foo/bar');
// page1
$t->diag('getFormattedFirstCommitted()');
$t->is($page->getFormattedFirstCommitted(), '2010/05/09', 'ページの、フォーマット済初回コミット日付');
$page = new Page();
$page->setRepository($repo);
$page->setPath('/path/to2');
$page->setContentRaw('content_raw');
$page->setContentType('content_type');
$page->setContentRendered('content_rendered');
$page->setTitle('title');
$page->setIndexJson('index_json');
$page->setLastUpdated('2010/01/02 03:04:05');
$page->save();
$page = PageTable::getInstance()->findOneByPath('/path/to2');
// page1
$t->diag('getFormattedFirstCommitted()');
$t->is($page->getFormattedFirstCommitted(), '', 'ページの、フォーマット済初回コミット日付 値未設定');
$page->setFirstCommitted(0);
$page->save();
$page = PageTable::getInstance()->findOneByPath('/path/to2');
// page1
$t->diag('getFormattedFirstCommitted()');
$t->is($page->getFormattedFirstCommitted(), '', 'ページの、フォーマット済初回コミット日付 値0');
Exemple #14
0
<?php

// test/unit/model/doctrine/CommitTest.php
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
// test環境でDB初期化
$configuration = ProjectConfiguration::getApplicationConfiguration('taskapp', 'test', true);
new sfDatabaseManager($configuration);
Doctrine_Core::loadData(dirname(__FILE__) . '/CommitFixture.yml');
$t = new lime_test(12);
// construct
$t->diag('__construct()');
$t->ok(new Commit() instanceof Commit, 'Commitインスタンス化');
$page = PageTable::getInstance()->findOneByPath('/foo/bar');
// create
$t->diag('create');
$commit = new Commit();
$commit->setCommittedAt('2010/05/19 01:02:03');
$commit->setAuthorHandle('author_handle');
$commit->setAuthorEmail('author_email');
$commit->setCommitterHandle('committer_handle');
$commit->setCommitterEmail('committer_email');
$commit->setCommitKey('commit_key');
$commit->setPage($page);
$commit->save();
$commit = CommitTable::getInstance()->findOneByCommitKey('commit_key');
$t->ok($commit instanceof Commit, 'レコードが正しく保存された');
$t->is($commit->getDateTimeObject('committed_at')->format('Y/m/d H:i:s'), '2010/05/19 01:02:03', 'コミット日時の保存');
$t->is($commit->getAuthorHandle(), 'author_handle', '作者ハンドルの保存');
$t->is($commit->getAuthorEmail(), 'author_email', '作者メールアドレスの保存');
$t->is($commit->getCommitterHandle(), 'committer_handle', 'コミッターハンドルの保存');
$t->is($commit->getCommitterEmail(), 'committer_email', 'コミッターメールアドレスの保存');
Exemple #15
0
 public function executeSlideshow(sfWebRequest $request)
 {
     $this->pages = PageTable::retrievePagesToMainSlideshow();
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->news_pages = PageTable::getListFromPath('/news', 'first_committed', 'desc', 10);
     $this->events_pages = PageTable::getListFromPath('/events', 'first_committed', 'desc', 10);
     $this->blog_pages = PageTable::getListFromPath('/blog', 'first_committed', 'desc', 10);
 }
Exemple #17
0
//
// +----------------------------------------------------------------------+
// | MoleCMS                                                              |
// +----------------------------------------------------------------------+
// | Copyright (c) 2000-2002 MoleManMedia Tim Franz                       |
// +----------------------------------------------------------------------+
// | Authors: Tim Franz <*****@*****.**>                               |
// +----------------------------------------------------------------------+
//
// $Id: overview.php,v 1.1 2002/08/07 09:25:40 moleman Exp $
$content['CONTENT'] .= "<h1>" . $lang->translate('Stellenbörse') . "</h1>";
$query = "select* from rc_jobs_category";
$bereich = $db_con->getAll($query, DB_FETCHMODE_ASSOC);
for ($i = 0; $i < count($bereich); $i++) {
    require_once 'mms_tablepager.php';
    $tabpage = new PageTable($cfg['database']['dsn'], "overview");
    $tabpage->make_url = false;
    $tabpage->str_emptyresult = "";
    $tabpage->indexcol = "id_job";
    $tabpage->fields = array("ueberschrift", "branche", "name", "region");
    $tabpage->map_cols = array("ueberschrift" => "Position", "branche" => "Branche", "region" => "Region", "name" => $lang->translate("Firma"));
    $tabpage->col_view = 'ueberschrift';
    $tabpage->url_view = url(array('module' => 'jobs', 'action' => 'details'));
    $tabpage->add_extra = false;
    $query = "SELECT * FROM rc_jobs LEFT JOIN rc_firma ON (id=firma) WHERE aktiv = 1 AND bereich =" . $bereich[$i]['id_jobcat'];
    $tabresult = $tabpage->get($query, 0, 'overview');
    if ($tabresult != "") {
        $content['CONTENT'] .= '<h2>' . $bereich[$i]['category_' . LC_LANG] . '</h2>';
        $content['CONTENT'] .= $tabresult;
    }
}