Exemplo n.º 1
0
 public function actionMoveCatalogAttribute()
 {
     echo 'test';
     $db = Yii::app()->db;
     $queryAllCatalog = 'select guid from KutuCatalog';
     $command = $db->createCommand($queryAllCatalog);
     //var_dump($command);die;
     $dataReader = $command->query();
     $rowSource = $dataReader->readAll();
     //var_dump($rowSource); die;
     $i = 0;
     foreach ($rowSource as $source) {
         $catalogGuid = $source['guid'];
         $query = "select * from KutuCatalogAttribute where catalogGuid='{$catalogGuid}'";
         $command = $db->createCommand($query);
         //var_dump($command);die;
         $dataReader = $command->query();
         $rows = $dataReader->readAll();
         $aRowFinal = array();
         foreach ($rows as $attribute) {
             $aRowFinal[$attribute['attributeGuid']] = $attribute['value'];
         }
         echo $i++ . '<br>';
         //var_dump($aRowFinal['fixedTitle']);
         $catalog = KutuCatalogTest::model()->findByPk($catalogGuid);
         //var_dump($catalog);
         $catalog->content = serialize($aRowFinal);
         $catalog->save();
     }
 }
Exemplo n.º 2
0
// 		{
// 			$i++;
// 			$tmpGuid = $catalog['guid'];
// 			if($i == $totalCatalog)
// 				$sGuid .= "'$tmpGuid'";
// 			else
// 				$sGuid .= "'$tmpGuid',";
// 		}
// 		//echo $sGuid;
// 		$catalogs = KutuCatalogTest::model()->findAllBySql("select KutuCatalogTest.* from KutuCatalogTest where guid IN ($sGuid)");
$i = 0;
foreach ($catalogs as $catalog) {
    $i++;
    $tmpGuid = $catalog['guid'];
    //$command=$db->createCommand("select t1.value title, t2.value subTitle, t3.value description, t4.value content from ((select * from KutuCatalogAttribute where catalogGuid='$tmpGuid' and attributeGuid='fixedTitle') as t1) LEFT JOIN ((select * from KutuCatalogAttribute where catalogGuid='$tmpGuid' and attributeGuid='fixedSubTitle') as t2) ON t1.catalogGuid=t2.catalogGuid LEFT JOIN ((select * from KutuCatalogAttribute where catalogGuid='$tmpGuid' and attributeGuid='fixedDescription') as t3) ON t2.catalogGuid=t3.catalogGuid LEFT JOIN ((select * from KutuCatalogAttribute where catalogGuid='$tmpGuid' and attributeGuid='fixedContent') as t4) ON t3.catalogGuid=t4.catalogGuid");
    $attribute = KutuCatalogTest::model()->findByPk($tmpGuid);
    //$row=unserialize($catalog->content);
    $row = unserialize($attribute->content);
    ?>
		<?php 
    if ($i % 2 == 0) {
        ?>
			<div class="boxItem" style="background:#f4f4f4;">
		<?php 
    } else {
        ?>
			<div class="boxItem">
		<?php 
    }
    ?>
			<div class="date">February 12, 2010, <a href="<?echo Yii::app()->baseUrl;?>/hole/default/info" rel="facebox"><img src="<?echo Yii::app()->theme->baseUrl;?>/images/quickview_icon.gif"> Quick View</a></div>