Ejemplo n.º 1
0
 public function executeEdit()
 {
     $id = $this->getRequestParameter('id');
     $this->forward404Unless($id);
     if (!myUtils::isUserRecord('SnippetPeer', $id, $this->getUser()->getId())) {
         $this->setFlash('error', 'You don\'t have enough credentials to edit this snippet.');
         $this->forward('site', 'message');
     }
     $code = SnippetPeer::retrieveByPk($id);
     $this->getRequest()->setParameter('title', $code->getTitle());
     $this->getRequest()->setParameter('raw_body', $code->getRawBody());
     $this->getRequest()->setParameter('tags', $code->getTag());
     $this->getRequest()->setParameter('managed_content', $code->getManagedContent());
     $this->getRequest()->setParameter('draft', $code->getDraft());
 }
Ejemplo n.º 2
0
    <span><?php 
echo $code->getTitle();
?>
</span>
    <?php 
if ($code->getMC() == 'true') {
    ?>
    <?php 
    echo image_tag('flag_blue.png', array('alt' => __('Managed Content'), 'title' => __('Managed Content')));
    ?>
    <?php 
}
?>

    <?php 
if ($sf_user->isAuthenticated() && myUtils::isUserRecord('SnippetPeer', $code->getId(), $sf_user->getGuardUser()->getId())) {
    ?>
    <?php 
    echo link_to(image_tag('page_edit.png', array('alt' => __('Edit'), 'title' => __('Edit'))), 'snippet/edit?id=' . $code->getId());
    ?>

    <?php 
    echo link_to(image_tag('page_delete.png', array('alt' => __('Delete'), 'title' => __('Delete'))), 'snippet/delete?id=' . $code->getId(), array('confirm' => 'Are you sure you want to delete this snippet?'));
    ?>
    <?php 
}
?>
</h1>

<?php 
include_partial('snippet/show', array('code' => $code));