Beispiel #1
0
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the GPL Version 2 section of the License file that
 * accompanied this code. If applicable, add the following below the
 * License Header, with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * If you wish your version of this file to be governed by only the CDDL
 * or only the GPL Version 2, indicate your decision by adding
 * "[Contributor] elects to include this software in this distribution
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 * single choice of license, a recipient has the option to distribute
 * your version of this file under either the CDDL, the GPL Version 2 or
 * to extend the choice of license to its licensees as provided above.
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 * Version 2 license, then the option applies only if the new code is
 * made subject to such option by the copyright holder.
 *
 * Contributor(s):
 *
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
 */
$status = Utils::getUrlParam('status');
TodoValidator::validateStatus($status);
$dao = new TodoDao();
$search = new TodoSearchCriteria();
$search->setStatus($status);
// data for template
$title = Utils::capitalize($status) . ' TODOs';
$todos = $dao->find($search);
Beispiel #2
0
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the GPL Version 2 section of the License file that
 * accompanied this code. If applicable, add the following below the
 * License Header, with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * If you wish your version of this file to be governed by only the CDDL
 * or only the GPL Version 2, indicate your decision by adding
 * "[Contributor] elects to include this software in this distribution
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 * single choice of license, a recipient has the option to distribute
 * your version of this file under either the CDDL, the GPL Version 2 or
 * to extend the choice of license to its licensees as provided above.
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 * Version 2 license, then the option applies only if the new code is
 * made subject to such option by the copyright holder.
 *
 * Contributor(s):
 *
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
 */
$todo = Utils::getTodoByGetId();
$todo->setStatus(Utils::getUrlParam('status'));
if (array_key_exists('comment', $_POST)) {
    $todo->setComment($_POST['comment']);
}
$dao = new TodoDao();
$dao->save($todo);
Flash::addFlash('TODO status changed successfully.');
Utils::redirect('detail', array('id' => $todo->getId()));
Beispiel #3
0
 /**
  * Get {@link Todo} by the identifier 'id' found in the URL.
  * @return Todo {@link Todo} instance
  * @throws NotFoundException if the param or {@link Todo} instance is not found
  */
 public static function getTodoByGetId()
 {
     $id = null;
     try {
         $id = self::getUrlParam('id');
     } catch (Exception $ex) {
         throw new NotFoundException('No TODO identifier provided.');
     }
     if (!is_numeric($id)) {
         throw new NotFoundException('Invalid TODO identifier provided.');
     }
     $dao = new TodoDao();
     $todo = $dao->findById($id);
     if ($todo === null) {
         throw new NotFoundException('Unknown TODO identifier provided.');
     }
     return $todo;
 }
Beispiel #4
0
 * specific language governing permissions and limitations under the
 * License.  When distributing the software, include this License Header
 * Notice in each file and include the License file at
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the GPL Version 2 section of the License file that
 * accompanied this code. If applicable, add the following below the
 * License Header, with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * If you wish your version of this file to be governed by only the CDDL
 * or only the GPL Version 2, indicate your decision by adding
 * "[Contributor] elects to include this software in this distribution
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 * single choice of license, a recipient has the option to distribute
 * your version of this file under either the CDDL, the GPL Version 2 or
 * to extend the choice of license to its licensees as provided above.
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 * Version 2 license, then the option applies only if the new code is
 * made subject to such option by the copyright holder.
 *
 * Contributor(s):
 *
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
 */
$todo = Utils::getTodoByGetId();
$dao = new TodoDao();
$dao->delete($todo->getId());
Flash::addFlash('TODO deleted successfully.');
Utils::redirect('list', array('status' => $todo->getStatus()));