public function actionIndex() { // return is required $root = Yii::$app->params['root']; $typesModel = new \app\models\Types(); $types = $typesModel->find()->all(); require_once dirname(dirname(__FILE__)) . "/php/model/HomeImage.php"; $hi = new \HomeImage(); $imagesList = $hi->getRollImages(); return $this->render('index', ['info' => '123', 'types' => $types, 'imagesList' => $imagesList, 'typeHref' => $root . "index.php?r=oshjf/types&"]); }
public function save_order() { $homeimage_array = $_POST['homeimage_id']; $order_array = $_POST['order']; $homeimage = new HomeImage(); foreach ($homeimage_array as $key => $value) { $homeimage_id = $value; $homeimage_order = $order_array[$key]; $homeimage->update('HomeImage', array('sequence' => $homeimage_order), 'id=' . $homeimage_id); } Flash::set('success', __('This homeimage sequence has been saved.')); redirect(get_url('homeimage')); }
public function readFromResultSet($rs) { $hi = new HomeImage(); $hi->readFromResultSetForThis($rs); return $hi; }
// 提交更改 $hi_modify = new HomeImage(); $id = $_POST["id"]; $iname = $_POST["iname"]; $href = $_POST["href"]; $rank = $_POST["rank"]; $hi_modify->setId($id); $hi_modify->loadById(); $hi_modify->setIname($iname); $hi_modify->setHref($href); $hi_modify->setRank($rank); $hi_modify->update(); header("location:homeImagesController.php"); exit; } $hi = new HomeImage(); $list = $hi->getRollImages(); echo "\n <table class='table'>\n <thead>\n <th>编号</th>\n <th>名称</th>\n <th>图片</th>\n <th>跳转链接</th>\n <th>添加时间</th>\n <th>优先级(优先级高的排在前面显示)</th>\n <th>操作</th>\n </thead>\n"; foreach ($list as $one) { ?> <tr> <td><?php echo $one->getId(); ?> </td> <td><?php echo $one->getIname(); ?> </td> <td><img src="<?php echo $one->getUrl();
</div> <?php $idx++; } } ?> </div> <!--End Room Desc block--> <div class="clear"> </div> </div> <!--End 1st Full block--> <?php $oImage = new HomeImage(); $imgs = $oImage->findAllFrom("Homeimage", "1=1 order by sequence"); $img1 = ''; $img2 = ''; $img3 = ''; $img4 = ''; $img5 = ''; $img6 = ''; $img7 = ''; $img8 = ''; $img9 = ''; $img10 = ''; $img11 = ''; $img12 = ''; $imgmore = ''; foreach ($imgs as $img) {