Jump to content

Destramic

Members
  • Content Count

    954
  • Joined

  • Last visited

Everything posted by Destramic

  1. interesting, ok so the user has inputted a date and your checking if the date is >= 18 or <100 if so then set date and if not it'll throw an exception. shouldnt a validation error message go back to the user in the form process? or should i just rely on client side validation for that. and if they pass client side validation then exceptions will be thrown if invalid. i hope you can elaborate on this please. thank you
  2. a controller for the header sounds good, but leaves me with the question how would i run two controllers or load the header controller into other controllers. what would be the best pattern/way please requinix? thank you for your patience
  3. what im trying to achive to know when there is available slots for a particular employee...in this case a gas engineer. SELECT scheduled_date, username, t.time_period, am.scheduled_time, pm.scheduled_time, (SELECT task_time FROM task_types WHERE type = 'Gas Service') AS task_time FROM users u INNER JOIN user_role_mappings urm ON urm.user_id = u.user_id INNER JOIN user_roles ur ON ur.user_role_id = urm.user_id INNER JOIN tasks t ON t.user_id = u.user_id LEFT JOIN (SELECT t.task_id, tt.task_time AS `scheduled_time` FROM tasks
  4. sorry requinix i think i may have no explained myself correcly, although you may understand what ive been trying to say. but i'll explain fully heres my layout on the left navigation you will see a count of 5 for the number of tasks. how my pages are put together <?php echo $this->render('header.html'); ?> login page <?php echo $this->render('footer.html'); ?> i could do what you said like so: <?php echo $this->render('header.html' array('task_count' => $user_tasks_count)); ?> login page <?php echo $this->r
  5. im trying to get the range of dates from my tasks table, ranging from current date to the last date...but i also want to get the date even if a result/task doesn't exist select DISTINCT(CURRENT_DATE()) as today, scheduled_date, (SELECT scheduled_date + INTERVAL 7 - weekday(scheduled_date) DAY FROM tasks order by scheduled_date desc limit 1) AS last_date from tasks HAVING today < last_date AND today > scheduled_date result: -------------------------------------------------------------------------- today
  6. I'm using my own framework that I built...I think it's pattern issues that I have. OK so in a typical page I'll load the header.html and footer.html with my content in between...now my header has a menu and I want to add result counts from my database. My header is also rendered on every page. Ie. Tasks (5) Just don't see a clear way of how this should be done. How is this typically done in the real world? Thank you
  7. That is possible with my view when rendering but still I would need to pass vars on each page which seems unlogical and long winded Preloading vars in my bootstrap may be the best way to do this then in my case. Thank you
  8. Hey guys I include my header to my pages by adding this to the top of the page $this->render ('myheader.html'); The problem is I want to pass results from my db to the navigation menu, which would require me to assign vars in each controller view that includes the header. What is the best way to do this please? Another way I can think off is assigning the results to my view in my bootstrap ready for the controllers...but I'm sure there is a more logical way. Thank you
  9. thats brilliant...thank you for your help Barand ? much appreciated.
  10. thank you for your quick reply. i would also need friday's date. ive been testing via sql, and think ive almost made a breakthrough, but i get an error. SELECT DATE_ADD(DATE('2018-08-14'), INTERVAL - WEEKDAY(DATE('2018-08-14')) DAY) AS 'week_start', DATE_ADD(week_start, INTERVAL 5 DAY) AS 'week_end'
  11. hey guys i have a little problem and not sure of the best way to tackle it, if you could help please. i have 2 url which could be like so tasks/ricky-powell/week/14/08/2018 tasls/ricky-powell/day/14/08/2018 now if /day/14/08/2018 then thats a simple query. SELECT task FROM tasks WHERE scheduled_date = '2018-08-14' but...if users selects to view tasks by week (mon-fri) then it becomes a little bit complicated. 14/08/2018 is today which is a tuesday, and i would need to get the range from date mon - fri. would it be easier to: 1. ensure weekly
  12. I feel with annotation also your force to learn a new syntax...I could also use traits for certian fields that are use widley throughout my site, which is cool. I concur with what your saying, and I'd also be able to get rid of the abstract too. I'll implement what you've said and try to build upon that. Thank you for your great input once again.
  13. last year a made a validion script that works simular to this but using annotation (like symphony). it was very long winded and messy, but although it worked perfectly i was never happy with how complicated it was. well i had a brain wave last night on how to simplify a validator without any annotation bs! this took me minutes to write, and would be nice to have an overall critique from you guru's. validator: <?php class Validator { private $entities = array(); private $error_messages = array(); public function __construct(array $entities)
  14. requinix thank you for your time in breaking down how things should work, as it's all alot clearer to me now and i'll be sure to adopt these changes into my framework. thanks again.
  15. brilliant i understand how it should work now....i'll change my code around so the request and response get sent from front controller to my controller. that way i'll be able to run this code in my front controller if dispatched. $controller = $this->dispatcher->dispatch(); $response = $controller->get_repsonse(); if ($reponse->get_response_code !== 200) { // deal with respsone code! { else { $response->send(): } also should i send my view through my front controller to controller like request and response?...or initialize my view in my asbtract control
  16. hey guys im trying to build custom http error pages into my framework but after days of thinking, i must admit defeat and ask for some help. ok so if i try to access a route which doesnt exist my dispatcher will send a 404 error in the send_404_error() method were http_reponse_code(404) is set and then it'll dispatch to the error controller (no problem). dispatcher: <?php namespace MVC\Dispatcher; use HTTP\Request; use HTTP\Response; use Exception; class Dispatcher { private $request; private $config; private $class; private $controller; private $
  17. it was just me trying all options to add transparency to that div. but thank you both for you time and efforts help me
  18. thank you gizmola, clear worked like a dream. I'll also take a closer look at that article too the layout is looking great thanks to you guys, but im still having the problem with z-index not working when applied to menu div. the .body-container has opacity: 0.7; but i want .left-container (menu) layer to come forward so the background doesn't appear through it like so here is the updated html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Dashboard</title> <link href="https://fonts.googleapis.com/css?family=Titi
  19. that works much better thank you max. when i try apply a margin to the top of the page it pushes the body down too...how can this be fixed please? and also i tried to add z-index to the header and left container to stop bg image showing through but its also not work. (trying to get the bg image to only show through content div) thanks again. updated: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Dashboard</title> <link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet"> <
  20. I'm having trouble getting the .body-container and .left-container to follow suit with the .content, the height of both divs don't seem to alter down. Also z-index doesnt work on .left-container as im trying to stop the background to show through that particular div. ive read it may be because of the absolue positioning. Any help on these matters would be great. thank you <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <style> body { background:url("https://image.ibb.co/h93Ndo/abstract.jpg") top right no-repea
  21. you need a trigger $(document).ready(function() { $('.trigger').click(function(){ $('input.player_search').typeahead({ name: 'player_name', remote: 'mysql.php?query=%QUERY', }); }); }) // the html trigger <button class="trigger">Search</button> i see some big security risks with your php also...your database is open to sql injection, you need to get that sorted before putting your script live. http://php.net/manual/en/mysqli.real-escape-string.php if you used PDO instead of mysqli you probably wouldnt have this problem.
  22. Thank you for your help...changing the int to string work perfectly
  23. hey guys im tyring to pass a integer to a method and i get this error: when using this code $this->get_model('contract:contracts')->send_verification_pin(070000000000); i could use quotes like so $this->get_model('contract:contracts')->send_verification_pin('070000000000'); but then the integer has the 0 missing at the beginning...this is my debug int(7000000000) /^07\d{9}$/ ["Phone Number: Invalid phone number."] where is this missing 0 please guys? thank you
  24. i wouldnt of thought of that...thank you barand for your time and effort
  25. well the tablet would't have a verfication pin...but i planned on having 1 table ie. network_contracts to hoild users contratcs such as sim only, mobile and tablet. the verification pin is for when a user adds sim only / mobile, a pin is then sent to users phone number which needs to be verified.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.