Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:02:46+00:00 2026-06-01T20:02:46+00:00

I am currently making a time-clock system that is inside of a custom-built application

  • 0

I am currently making a time-clock system that is inside of a custom-built application (CRM) that a previous developer did. I’ve got the timeclock coming along nicely but have just a few questions..

Upon clocking in I set a session like so: $this->get('session')->set('clockedin', 'true');

I set a session so that I in order to show the clockin or clockout button I figured the easiest method would be to just read a session variable to determine which button to show using a twig if/else statement in the templates (i have the buttons show in 2 places, 1 is in every page and 1 is only in the timeclock system itself)

So, is this the best way to go about doing this or is there a better recommended way of going about it?

The next thing I wondered about is session expiration… in my config.yml I see:

session:
    cookie_lifetime:       43200
    auto_start:     true

So, does this mean that the way i’ve set it lasts for 12 hours? Or in order for that to be true, would I need to use a cookie instead? I think that a cookie might be better, because if the browser closes (many of the employees aren’t technologically inclined) I’d need this to be a persistent upon the next page load..

Thanks for any help..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:02:46+00:00Added an answer on June 1, 2026 at 8:02 pm

    If another indefinitely later operation depends on clockedin state I would not rely on sessions. If user logs him/herself out session gets invalidated (whole session), so clockedin would be lost.

    I would rather use {% include %} or {% render %} to determine state every time you need to display that button. For example:

    /**
     * @Template()
     */
    public function clockedInAction(){
       .... // do some login here
       $clocked_in = ....;
       return array(
            'clockedin' => $clockedin
       );
    }
    

    and in your Twig:

    {% render "AcmeBundle:SomeController:clockedIn" %}
    

    Template of this controller would contains that {% if .... %} you wanted originally:

    {# AcmeBundle:SomeController:clockedIn.html.twig #}
    {% if clockedIn %}
       display "Clocked In" button
    {% else %}
       display "Clocked Out" button
    {% endif %}
    

    Now, this is more expensive since on each request you have to assess the situation and then print appropriate template, but it’s always consistent with a system…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making some system that will gather statistical reports from different sites, for
I am currently making a Facebook iOS Application and In the app I am
I'm currently making an iPhone app that has PDF viewing a crucial part of
I'm currently making a PHP-program that solves equations. I've divided the input equation into
I'm currently making an application for WP7 where I'm implementing a currency exchange solution.
I'm creating an android application that gets the current time in a different country/time-zone.
Hi im currently making a xmhhttp request, but the site takes some time to
I am currently making a rails app that will search #barcampmlk2 #{thesessionname} +1 from
I'm currently making a word game for iOS that, when loading, reads in a
Currently I am making a IRC that sends a message onto the IRC main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.