We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13438
    • 16 Posts
    Hi everybody!

    I’m trying to build an intranet and want to create a JOB POSTING page.


    1. User from front end can Insert Data into the table
    2. After inserting that Data, it will display in a Page Resource
    3. User can edit or delete data.

    I’m using Eform2DB and I’m able to insert data into table but I want user to delete old data. Any help is appreciated right now I’m stuck in viewing the content of that table.

    Thank you! smiley

    Issue right now:
    <?php
    $output = '';//create variable for holding the output
    $sql = $modx_intranet->db->query( 'SELECT * FROM `modx_intranet_cargas` LIMIT 0, 1000');//define the DB query, in this case the table is named 'tblprojects', add WHERE AND etc. as needed
    $resultArray = $modx_intranet->db->makeArray( $sql );//put it into an array
    foreach($resultArray as $item)//go through each record in the array
    {//start looping through the data array
    $params['position']=$item['position'];  //set the placeholders, the $params sets the name of the placeholder, the $item is the column name from the DB table
    $params['locat']=$item['location'];
    $params['ftp']=$item['ftpt'];
    $params['cperson']=$item['contactperson'];
    $params['phne']=$item['phone'];
    $output.=$modx->parseChunk('ProjectTpl', $params, '[+', '+]');//define the chunk name and process the content, here it's ProjectTpl which has the placeholders for the data
    }//finish looping through the data array
    return $output;//now return the output from the processed chunk
    ?>


    For some reason it does not display anything but when I go to phpmyadmin i have data there.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You could use Jot for this. Set Jot up so the users can edit/delete their own posts, and have one page for the form (&action=`form`) and another page to display the job listings (&action=`comments`).

      I have a modified version of Jot that I called Notes that adds a field for category which works well with a drop-down select in the form, and allows for filtering on categories when displaying the list, as well as a field for ordering, which goes nicely with an AJAX drag-and-drop ordering feature if that’s wanted.

      One big advantage of using Jot/Notes is the moderation feature, as well as the subscription and notification features.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 13438
        • 16 Posts
        Thank you so much for quick response! ok the problem I see is that I just want this specific person that adds this data, to be the only one to be able to delete or modify. Just to explain better right now this person writes a DOC on word and attaches to an email which sends to the whole company with the new Job posting positions.

        So the reason I decided to look into eform2db is that I can do both in one single hit. She will be able to send the data over and email after inserting into form and display it, into the page resource. I hope I’m explaining well.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I see. In either case, you’ll need to do some custom coding. I would prefer to custom code a mail feature than messing with the database if at all possible, so I would still use Jot/Notes, and add a "Mail" button to the form page under the form that uses AJAX to email the Jot listing display page to a list. Easy enough to just rip off the mailing code from eForm. Better than an attachment, actually, especially as it’s not the safest thing in the world to be opening .doc attachments in email no matter who you think it’s coming from.

          The whole huge advantage to using Jot for managing items that don’t really belong in resources is the moderation feature, where the user can delete, unpublish, publish or edit the entries. Its form and output templates work like Wayfinder or Ditto, so you can make them look like anything you want. It has phx built-in so the tpls can have conditionals without installing the phx plugin. Jot’s custom fields would come in handy here as well. I frequently use it for items that need to be easily and quickly edited or added to and that I want displayed in a specific format for Javascript sliders or accordions, such as client quotes or employee bios.

          Depending on how big this mailing list will be, I would consider setting up the DADA mailer and using that to mail off the page to the list. It’s a perl script, and a very powerful mailing application. You can trigger its functions via PHP’s perl extensions ( http://devzone.zend.com/article/1712 ). I have embedded it as a module very easily.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org