Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

element with share links

  • Loading branch information...
commit 870f9c7e7915dbe30dedb38e29622b1dc47cc402 1 parent 4d0c0c5
@maurozadu maurozadu authored
View
15 plugins/posts/views/elements/share_options.ctp
@@ -0,0 +1,15 @@
+<?php
+$urlShare = array(
+ 'controller' => 'share_links', 'action' => 'create', 'target_type' => 'Post',
+ 'target_id' => $post['Post']['id'], 'target_owner' => 'unknown', 'plugin' => false,
+);
+if (!empty($userData['User']['id'])) {
+ $urlShare['owner_id'] = $userData['User']['id'];
+}
+?>
+<h2>Share options</h2>
+<ul>
+ <li><?php echo $this->Html->link('without security', array_merge($urlShare, array('security_level' => 1))); ?></li>
+ <li><?php echo $this->Html->link('password (pwd: 123)', array_merge($urlShare, array('security_level' => 2, 'hashed_password' => '123'))); ?></li>
+ <li><?php echo $this->Html->link('require login', array_merge($urlShare, array('security_level' => 3))); ?></li>
+</ul>
View
5 plugins/posts/views/posts/view.ctp
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* Sample Comments Application
*
@@ -18,6 +18,9 @@
<?php __('Post');?>: <?php echo $post['Post']['name'];?>
</div>
+<?php echo $this->element('share_options'); ?>
+
+
<div id="comments">
<?php $commentWidget->options(array(
'allowAnonymousComment' => false,
Please sign in to comment.
Something went wrong with that request. Please try again.