Ejemplo n.º 1
0
 public function testConstructMethod()
 {
     $data = [];
     $attribute = ['customer_id', 'status'];
     $customerId = 25;
     $layout = $this->getMock('Magento\\Core\\Model\\Layout', ['getBlock'], [], '', false, false);
     $this->context->expects($this->once())->method('getLayout')->will($this->returnValue($layout));
     $this->customerSession->expects($this->once())->method('getCustomerId')->will($this->returnValue($customerId));
     $statuses = ['pending', 'processing', 'complete'];
     $this->orderConfig->expects($this->once())->method('getVisibleOnFrontStatuses')->will($this->returnValue($statuses));
     $orderCollection = $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Collection', ['addAttributeToSelect', 'addFieldToFilter', 'joinAttribute', 'addAttributeToFilter', 'addAttributeToSort', 'setPageSize', 'load'], [], '', false, false);
     $orderCollection->expects($this->at(0))->method('addAttributeToSelect')->with($this->equalTo('*'))->will($this->returnSelf());
     $orderCollection->expects($this->at(1))->method('joinAttribute')->with('shipping_firstname', 'order_address/firstname', 'shipping_address_id', $this->equalTo(null), 'left')->will($this->returnSelf());
     $orderCollection->expects($this->at(2))->method('joinAttribute')->with('shipping_lastname', 'order_address/lastname', 'shipping_address_id', $this->equalTo(null), 'left')->will($this->returnSelf());
     $orderCollection->expects($this->at(3))->method('addAttributeToFilter')->with($attribute[0], $this->equalTo($customerId))->will($this->returnSelf());
     $orderCollection->expects($this->at(4))->method('addAttributeToFilter')->with($attribute[1], $this->equalTo(['in' => $statuses]))->will($this->returnSelf());
     $orderCollection->expects($this->at(5))->method('addAttributeToSort')->with('created_at', 'desc')->will($this->returnSelf());
     $orderCollection->expects($this->at(6))->method('setPageSize')->with('5')->will($this->returnSelf());
     $orderCollection->expects($this->at(7))->method('load')->will($this->returnSelf());
     $this->orderCollectionFactory->expects($this->atLeastOnce())->method('create')->will($this->returnValue($orderCollection));
     $this->model = new \Magento\Sales\Block\Order\Recent($this->context, $this->orderCollectionFactory, $this->customerSession, $this->orderConfig, $data);
     $this->assertEquals($orderCollection, $this->model->getOrders());
 }
Ejemplo n.º 2
0
 public function getIsCreateUser($pk, $model)
 {
     if ($model == "diary" && Diary::model()->findByPk($pk)->create_user == Yii::app()->user->id) {
         return true;
     } else {
         if ($model == "photo" && Photo::model()->findByPk($pk)->create_user == Yii::app()->user->id) {
             return true;
         } else {
             if ($model == "recent" && Recent::model()->findByPk($pk)->create_user == Yii::app()->user->id) {
                 return true;
             } else {
                 if ($model == "timeline" && Timeline::model()->findByPk($pk)->create_user == Yii::app()->user->id) {
                     return true;
                 } else {
                     if ($model == "pictue" && Picture::model()->findByPk($pk)->create_user == Yii::app()->user->id) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
Ejemplo n.º 3
0
      <ul class="nav navbar-nav" style="margin-left:30%;">
         <li title="Aynen haberleşiriz"><a href="iletisim.php">iletişim</a></li>
         <li title="Ciddi meseleler"><a href="sartlar.php">kullanım koşulları</a></li>
         <li title="[S]ıklıkla [S]orulan [S]orular"><a href="sss.php">sss</a></li>
	 <li title="Facebook sayfamız"><a href="https://www.facebook.com/theserinhikaye">facebook</a></li>
	 <li title="Twitter sayfamız"><a href="https://twitter.com/TheSerinHikaye">twitter</a></li>
	 <li title="Kim bu gizemli insanlar ?"><a href="bizkimiz.php">biz kimiz ?</a></li>
      </ul>
   </div>
</nav>

<?php 
include_once "classes/Upmenu.class.php";
include_once "classes/Recent.class.php";
$myUpmenu = new Upmenu();
$myRecent = new Recent();
echo "<div class=\"container\">";
echo "<div class=\"row\">";
echo "<div class=\"col-sm-12 col-md-12\">";
$myUpmenu->UpmenuToHTML();
echo "</div>";
echo "</div>";
echo "<div class=\"row\">";
echo "<div class=\"col-sm-12 col-md-12\">";
$myRecent->RecentToHTML();
echo "</div>";
echo "</div>";
echo "</div>";
?>

</html>
Ejemplo n.º 4
0
 /**
  * 获取JSON Portal数据
  */
 public static function getCommentJSONData($type = "")
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'remind_time desc';
     $criteria->condition = '(to_id = :to_id and remind_flag != :to_remind_flag and delete_flag != :to_delete_flag)';
     $criteria->params = array(':to_id' => Yii::app()->user->id, ':to_remind_flag' => $type == "" ? 1 : 2, ':to_delete_flag' => 1);
     $models = self::model()->findAll($criteria);
     $data = array();
     foreach ($models as $model) {
         $contentModel = NotificationContent::model()->findByPk($model->content_id);
         if ($contentModel->notification_type != "attention" && $contentModel->notification_type != "report") {
             $pk_id = Comment::model()->findByPk($contentModel->pk_id)->pk_id;
             if ($contentModel->notification_type == "answer") {
                 $dataUrl = Yii::app()->controller->createUrl("diary", array("action" => "view", "id" => $pk_id, "pk_id" => $model->id));
             } else {
                 if ($contentModel->notification_type == "topic") {
                     $dataUrl = Yii::app()->controller->createUrl("topic", array("id" => $pk_id, "pk_id" => $model->id));
                 } else {
                     if ($contentModel->notification_type == "picture") {
                         $dataUrl = Yii::app()->controller->createUrl("picturewall", array("type" => "sharepicture", "id" => $pk_id, "pk_id" => $model->id));
                     } else {
                         if ($contentModel->notification_type == "recent") {
                             $user_id = Recent::model()->findByPk($pk_id)->create_user;
                             $dataUrl = Yii::app()->controller->createUrl("recent", array("type" => "other", "action" => "view", "id" => $pk_id, "user_id" => $user_id, "pk_id" => $model->id));
                         } else {
                             if ($contentModel->notification_type == "timeline") {
                                 $dataUrl = Yii::app()->controller->createUrl("timeline", array("type" => "action", "action" => "view", "id" => $pk_id, "pk_id" => $model->id));
                             }
                         }
                     }
                 }
             }
             $data[] = array('id' => $model->id, 'desc' => Comment::model()->findByPk($contentModel->pk_id)->content, 'content' => $contentModel->content, 'remindFlag' => $model->remind_flag, 'createUserId' => $contentModel->from_id, 'createUser' => User::getNameById($contentModel->from_id), 'createTime' => Comment::model()->timeintval($contentModel->send_time), 'avatarSrc' => User::getAvatarById($contentModel->from_id), 'dataUrl' => $dataUrl);
         }
     }
     return $type == "" ? CJSON::encode($data) : $data;
 }