Ejemplo n.º 1
0
 public function appreciationMore()
 {
     $video_id = Input::get('video_id');
     $video = Appreciation::find($video_id);
     if ($video != null) {
         return Response::json(array('errCode' => 0, 'message' => '可播放视频', 'viedo' => $video));
     }
     return Response::json(array('errCode' => 1, 'message' => '无可播放视频'));
 }
Ejemplo n.º 2
0
 public function run()
 {
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
     Appreciation::create(['title' => '史记-秦始皇的故事', 'video' => 'http://player.youku.com/embed/XMTI4NjQ4Njg0MA==', 'video_img' => 'http://7xk6xh.com1.z0.glb.clouddn.com/3.JPG']);
 }
Ejemplo n.º 3
0
 public function appreciation()
 {
     $appreciations = Appreciation::paginate(10);
     return View::make('经典欣赏')->with('appreciations', $appreciation);
 }
Ejemplo n.º 4
0
 public function editAppreciation()
 {
     $appreciation_id = Input::get('appreciation_id');
     $title = Input::get('title');
     $video = Input::get('video');
     $data = array('title' => $title, 'video' => $video);
     $rules = array('title' => 'required', 'video' => 'required');
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         return Response::json(array('errCode' => 1, 'message' => '信息填写不完整!'));
     }
     $appreciation = Appreciation::find($appreciation_id);
     $appreciation->title = $title;
     $appreciation->video = $video;
     if (!$appreciation->save()) {
         return Response::json(array('errCode' => 2, 'message' => '编辑失败!'));
     }
     return Response::json(array('errCode' => 0, 'message' => '编辑成功!'));
 }
Ejemplo n.º 5
0
        echo "<priority>" . ($p->isHomePage() ? 1 : number_format(0.5 / $p->depth(), 1)) . "</priority>";
        echo "</url>";
    }
    echo '</urlset>';
}), array('method' => 'GET', 'pattern' => 'appreciate', 'action' => function () {
    return go(kirby()->request()->referer());
}), array('method' => 'POST', 'pattern' => 'appreciate', 'action' => function () {
    // Return if no ID was sent
    if (get('page_id') == '') {
        return go(kirby()->request()->referer());
    }
    // Create the appreciation
    $a = new Appreciation(site());
    $entry = $a->appreciate(get('page_id'));
    // Send an email
    $email = new Email(array('to' => c::get('site_email'), 'from' => 'Aurer emailer <*****@*****.**>', 'subject' => 'Someone appreciates your work', 'body' => 'Page: ' . $entry['page'] . "\nTime: " . date('D, jS M, Y, G:i', $entry['timestamp']) . "\nIP: " . $entry['ip'], 'service' => 'mailgun', 'options' => array('key' => c::get('mailgun_key'), 'domain' => c::get('mailgun_domain'))));
    // Log email failures
    if (!$email->send()) {
        error_log($email->error());
    }
    // Return JSON result
    return response::json($entry);
}), array('method' => 'POST', 'pattern' => 'appreciate/comment', 'action' => function () {
    if (!get('id')) {
        return go(kirby()->request()->referer());
    }
    $a = new Appreciation(site());
    $data = (object) array('comments' => get('comments'), 'name' => get('name'));
    $entry = $a->add_comment(get('id'), $data);
    return response::json($entry);
})));
Ejemplo n.º 6
0
<?php

$a = new Appreciation(site());
$entries = $a->get_user_entries($page->id());
?>
<div class="section section--appreciate">
	<div class="section-inner">
		<?php 
if ($entries && count($entries) > 0) {
    ?>
			<button disabled class="appreciate appreciate--active">
				<svg width="20" height="20" fill="#ffffff">
				  <use xlink:href="/assets/images/icon-defs.svg#heart"></use>
				</svg>
			</button>
		<?php 
} else {
    ?>
	  	<button class="appreciate" data-page_id="<?php 
    echo $page->id();
    ?>
">
				<svg width="20" height="20" fill="#ffffff">
				  <use xlink:href="/assets/images/icon-defs.svg#heart"></use>
				</svg>
	  	</button>
	  <?php 
}
?>
	</div>
</div>