public function createAction() { $entity = new Faq(); $entity->load_from_array($this->request->getParam("faq")); if (save_faq($entity)) { $this->flash->setSuccess("New Question added successfully!"); $this->redirect_to(project_show_path($entity->project_id)); } else { $this->flash->setError("There was an error saving the question. Both fields are required."); //$this->render(array("entity" => $entity), "new"); $this->redirect_to(project_show_path($entity->project_id)); } }
<?php echo link_to(project_show_path($proj), truncate_string($proj->name, 10), array("class" => "project-lnk")); ?> <span class="language">(<?php echo $proj->language; ?> )</span> <p class="project-description"> <?php echo truncate_string($proj->description, 90); ?> </p> <?php echo link_to(project_show_path($proj), '<i class="fui-eye-24"></i> Read more', array("class" => "btn btn-large btn-primary ")); ?> <?php if ($current_user) { ?> <?php echo link_to(project_unpublish_path($proj), '<i class="fui-cross-24"></i> Un-publish', array("id" => "unpublish-btn", "class" => "btn btn-large btn-remove")); ?> <?php } ?> <?php } else { ?>
public function createAction() { $entity = new Project(); $proj = $this->request->getParam("project"); $dev = load_developer_where('name = "' . $this->request->getParam("owner_name") . '"'); if ($dev == null) { //Create the developer if it's not on our database already $dev = new Developer(); $dev->name = $this->request->getParam("owner_name"); $dev->avatar_url = $this->request->getParam("owner_avatar"); save_developer($dev); } else { //Update the avatar if it changed if ($dev->avatar_url != $this->request->getParam("owner_avatar")) { $dev->avatar_url = $this->request->getParam("owner_avatar"); save_developer($dev); } } if (!load_project_where("name = '" . $proj['name'] . "' and owner_id = " . $dev->id)) { $proj['url'] = str_replace("https", "", $proj['url']); $proj['url'] = str_replace("http", "", $proj['url']); $proj['url'] = str_replace("://", "", $proj['url']); $proj['url'] = "http://" . $proj['url']; $proj['owner_id'] = $dev->id; $proj['published'] = 1; $entity->load_from_array($proj); if (save_project($entity)) { //Create the first set of stats $entity->saveInitStats(); $entity->grabHistoricData(); $this->flash->setSuccess("The project was added correctly, thanks!"); $this->redirect_to(project_show_path($entity)); } else { $this->render(array("entity" => $entity), "new"); } } else { $this->flash->setError("This project has already been submited"); $this->render(array("entity" => $entity), "new"); } }
</li> </ul> <div class="clearfix"></div> </div> <p><?php echo truncate_string($entity->description, 70); ?> </p> <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $entity->url; ?> " data-text="Checkout this cool project on @Github!" data-via="lookingfor_pr">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> <?php echo link_to(project_show_path($entity), '<span class="fui-eye-24"></span> View Stats', array("class" => "btn btn-primary btn-large")); ?> </div> </div> <?php } ?> </div> <?php } else { ?> <div class="alert alert-warning"> <h2>So... this is a bit embarrassing...</h2> We were unable to find results for your search, please try again using different parameters :) </div> <?php