コード例 #1
0
ファイル: Lists.php プロジェクト: kotow/work
 public static function updateListCache($listId = null)
 {
     if ($listId) {
         $list = Lists::getListByListId($listId);
         $lists = array($list);
     } else {
         if ($listsRootFolder = Rootfolder::getRootfolderByModule("lists")) {
             $lists = Document::getChildrenOf($listsRootFolder->getId(), "Lists");
         }
     }
     foreach ($lists as $list) {
         $listId = $list->getListId();
         $listPath = sfConfig::get('sf_root_dir') . "/cache/listscache/" . $listId . ".php";
         @unlink($listPath);
         $content = "<?php \n";
         $content .= "\$listItemsForSelect = array(\n";
         $items = Lists::getListitemsForSelect($listId, array(), false);
         foreach ($items as $key => $item) {
             $content .= "\"" . str_replace("\"", "\\\"", $key) . "\" => \"" . str_replace("\"", "\\\"", $item) . "\",\n";
         }
         $content .= ");\n?>";
         FileHelper::writeFile($listPath, $content);
     }
 }