/** * Method to check out an item for editing and redirect to the edit form. * * @return void * * @since 1.6 */ public function edit() { $app = JFactory::getApplication(); // Get the previous edit id (if any) and the current edit id. $previousId = (int) $app->getUserState('com_akrecipes.edit.recipe.id'); $editId = $app->input->getInt('id', 0); // Set the user id for the user to edit in the session. $app->setUserState('com_akrecipes.edit.recipe.id', $editId); // Get the model. $model = $this->getModel('Recipe', 'AkrecipesModel'); // Check out the item if ($editId) { $model->checkout($editId); } // Check in the previous user. if ($previousId && $previousId !== $editId) { $model->checkin($previousId); } // Redirect to the edit screen. $edit_url = AkrecipesHelperRoute::getFormRoute($editId); error_log("AkrecipesControllerRecipe::edit Redirecting to -> " . $edit_url); //$this->setRedirect($edit_url,false); }
<?php } ?> </div> <?php } ?> <?php if ($canCreate) { ?> <a href="<?php echo JRoute::_(AkrecipesHelperRoute::getFormRoute(), false, 2); ?> " class="btn btn-success btn-small"><i class="icon-plus"></i> <?php echo JText::_('COM_AKRECIPES_ADD_ITEM'); ?> </a> <?php } ?> <?php echo $this->pagination->getListFooter(); ?>
?> </a> </h3> <?php if ($unpublished) { ?> <span class="label label-warning"><?php echo $unpublished; ?> </span> <?php if ($unpublished == JTEXT::_('COM_AKRECIPES_JUNPUBLISHED') && $canEdit) { ?> <a class="btn btn-primary btn-xs" href="<?php AkrecipesHelperRoute::getFormRoute($recipe->id); ?> ">Edit</a> <?php } ?> <?php } ?> <div class="recipedate"> <?php echo JHTML::_('date', $recipe->publish_up, JText::_('DATE_FORMAT_LC2')); ?> </div> <div class="recipedescription">
?> </span> </a> </h3> <?php if ($unpublished) { ?> <span class="label label-warning"><?php echo $unpublished; ?> </span> <?php if ($unpublished == JTEXT::_('COM_AKRECIPES_JUNPUBLISHED') && $canEdit) { ?> <a class="btn btn-primary btn-xs" href="<?php echo JRoute::_(AkrecipesHelperRoute::getFormRoute($item->id)); ?> ">Edit</a> <?php } ?> <?php } ?> <div class="recipe_author"> <?php if (isset($item->user->akprofile['image'])) { ?> <div class="pull-left">
?> </a> </h3> <?php if ($unpublished) { ?> <span class="label label-warning"><?php echo $unpublished; ?> </span> <?php if ($unpublished == JTEXT::_('COM_AKRECIPES_JUNPUBLISHED') && $canEdit) { ?> <a class="btn btn-primary btn-xs" href=" <?php AkrecipesHelperRoute::getFormRoute($item->id); ?> ">Edit</a> <?php } ?> <?php } ?> <div class="recipedate"> <?php echo JHTML::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC1')); ?> </div>
<?php echo $item->recipe_name; ?> </h3> <?php if ($unpublished) { ?> <span class="label label-warning"><?php echo $unpublished; ?> </span> <?php if ($unpublished == JTEXT::_('COM_AKRECIPES_JUNPUBLISHED') && $canEdit) { ?> <a class="btn btn-primary btn-xs" href="<?php echo JRoute::_(AkrecipesHelperRoute::getFormRoute((int) $item->id), false, 2); ?> ">Edit</a> <?php } ?> <?php } ?> <div class="recipedescription"> <p itemprop="description"><?php echo AkrecipesFrontendHelper::truncate_text($item->recipe_description, 150, true); ?> </p> </div>