sfTodoPlugin - 1.1.1

Todo List Commponent

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfTodoPlugin

Add a simple list of tasks easily with this plugin.

Like it? Contribute! Follow/Fork the project at github: https://github.com/marciotoze/sfTodoPlugin

Installation

  • Install the plugin (via a package)

    symfony plugin:install sfTodoPlugin
    
  • Install the plugin (via a Subversion checkout)

  • Activate the plugin

    #config/ProjectConfiguration.class.php
    class ProjectConfiguration extends sfProjectConfiguration
    {
      public function setup()
      {
        $this->enablePlugins(array(
          'sfDoctrinePlugin', 
          'sfTodoPlugin',
          '...'
        ));
      }
    }
  • Rebuild your model

    symfony doctrine:build-model
    symfony doctrine:build-sql
    
  • Update you database tables by starting from scratch (it will delete all the existing tables, then re-create them):

    symfony doctrine:insert-sql
    
  • Load default fixture (Optional, but recommended)

    symfony doctrine:data-load frontend # replace frontend with the name of one of your application
    

    or do everything with one command

    symfony doctrine-build-all-reload frontend # replace frontend with the name of one of your application
    
  • Enable module in your settings.yml all: .settings: enabled_modules: [default, todo, ...]

  • Clear you cache

    symfony cc
    
  • Finally add the component into layout template or module template you want

    #app/frontend/templates/layout.php
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <?php include_http_metas() ?>
        <?php include_metas() ?>
        <?php include_title() ?>
        <link rel="shortcut icon" href="/favicon.ico" />
        <?php include_stylesheets() ?>
        <?php include_javascripts() ?>
      </head>
      <body>
        <?php echo $sf_content ?>
     
        <?php include_component('todo', 'index') ?> #
     
      </body>
    </html>

Configuration

  • Pre-formated theme

    You can remove a pre-formated layout of Todo-List just by setting the parameter formated to false in plugins/sfTodoPlugin/config/app.yml

    all:
      sf_todo_plugin:
        formated: false                       #if true, the component will load a css to pre-format the Todo-List
    
  • Integration with sfDoctrineGuardPlugin

    You can integrate Todo-List with sfDoctrineGuardPlugin setting the parameter use_sf_doctrine_guard to true in plugins/sfTodoPlugin/config/app.yml

    all:
      sf_todo_plugin:
        use_sf_doctrine_guard: true         #if true, each guard user will see one Todo-List, but the list will only work with authenticated user.
    
    • fixing the integration (Optional, but recommended)

    if you are using the sfDoctrineGuardPlugin integration then you should fix a database relation by adding the following lines in plugin/config/schema.yml

    Tasks:
      options:
        symfony:
          filter: false
      actAs:
        Timestampable: ~
      columns:
        name:                           { type: string(255) }
        sf_guard_user_id:               { type: integer }
        priority_id:                    { type: integer, notnull: true }
        status:                         { type: boolean, default: true }
      relations:
        Priority:                       { local: priority_id, foreign: id, foreignAlias: Users, onDelete: CASCADE }
        sfGuardUser:                    #Fixing relationship
    
    Priority:
      columns:
        name:                           { type: string(255), notnull: true }
      options:
        symfony:
          filter: false
    

    regenerate the database and you'll be ok. :)