Jobs creater

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Jobs creater

      I need your help guys,

      I want to create jobs via the admin page as I do with the news

      this is my ShowNewsPage.php in /includes/pages/adm

      PHP Source Code

      1. if (!allowedTo(str_replace(array(dirname(__FILE__), '\\', '/', '.php'), '', __FILE__))) throw new Exception("Permission error!");
      2. function ShowNewsPage(){
      3. global $LNG, $USER;
      4. if($_GET['action'] == 'send') {
      5. $edit_id = HTTP::_GP('id', 0);
      6. $title = $GLOBALS['DATABASE']->sql_escape(HTTP::_GP('title', '', true));
      7. $text = $GLOBALS['DATABASE']->sql_escape(HTTP::_GP('text', '', true));
      8. $query = ($_GET['mode'] == 2) ? "INSERT INTO ".NEWS." (`id` ,`user` ,`date` ,`title` ,`text`) VALUES ( NULL , '".$USER['username']."', '".TIMESTAMP."', '".$title."', '".$text."');" : "UPDATE ".NEWS." SET `title` = '".$title."', `text` = '".$text."', `date` = '".TIMESTAMP."' WHERE `id` = '".$edit_id."' LIMIT 1;";
      9. $GLOBALS['DATABASE']->query($query);
      10. } elseif($_GET['action'] == 'delete' && isset($_GET['id'])) {
      11. $GLOBALS['DATABASE']->query("DELETE FROM ".NEWS." WHERE `id` = '".HTTP::_GP('id', 0)."';");
      12. }
      13. $query = $GLOBALS['DATABASE']->query("SELECT * FROM ".NEWS." ORDER BY id ASC");
      14. while ($u = $GLOBALS['DATABASE']->fetch_array($query)) {
      15. $NewsList[] = array(
      16. 'id' => $u['id'],
      17. 'title' => $u['title'],
      18. 'date' => _date($LNG['php_tdformat'], $u['date'], $USER['timezone']),
      19. 'user' => $u['user'],
      20. 'confirm' => sprintf($LNG['nws_confirm'], $u['title']),
      21. );
      22. }
      23. $template = new template();
      24. if($_GET['action'] == 'edit' && isset($_GET['id'])) {
      25. $News = $GLOBALS['DATABASE']->getFirstRow("SELECT id, title, text FROM ".NEWS." WHERE id = '".$GLOBALS['DATABASE']->sql_escape($_GET['id'])."';");
      26. $template->assign_vars(array(
      27. 'mode' => 1,
      28. 'nws_head' => sprintf($LNG['nws_head_edit'], $News['title']),
      29. 'news_id' => $News['id'],
      30. 'news_title' => $News['title'],
      31. 'news_text' => $News['text'],
      32. ));
      33. } elseif($_GET['action'] == 'create') {
      34. $template->assign_vars(array(
      35. 'mode' => 2,
      36. 'nws_head' => $LNG['nws_head_create'],
      37. ));
      38. }
      39. $template->assign_vars(array(
      40. 'NewsList' => $NewsList,
      41. 'button_submit' => $LNG['button_submit'],
      42. 'nws_total' => sprintf($LNG['nws_total'], count($NewsList)),
      43. 'nws_news' => $LNG['nws_news'],
      44. 'nws_id' => $LNG['nws_id'],
      45. 'nws_title' => $LNG['nws_title'],
      46. 'nws_date' => $LNG['nws_date'],
      47. 'nws_from' => $LNG['nws_from'],
      48. 'nws_del' => $LNG['nws_del'],
      49. 'nws_create' => $LNG['nws_create'],
      50. 'nws_content' => $LNG['nws_content'],
      51. ));
      52. $template->show('NewsPage.tpl');
      53. }
      Display All




      and this is the NewsPage.tpl

      HTML Source Code

      1. {include file="overall_header.tpl"}
      2. {include file="head_nav.tpl"}
      3. {nocache}{if isset($mode)}
      4. <form method="POST" action="?page=news&action=send&mode={$mode}">
      5. {if $news_id}<input name="id" type="hidden" value="{$news_id}">{/if}
      6. <table>
      7. <tr>
      8. <th colspan="2">{$nws_head}</th>
      9. </tr>
      10. <tr>
      11. <tr>
      12. <td width="25%">{$nws_title}</td><td><input type="text" name="title" value="{$news_title}"></td>
      13. </tr>
      14. <tr>
      15. <td>{$nws_content}</td><td><textarea cols="70" rows="10" name="text">{$news_text}</textarea></td>
      16. </tr>
      17. <tr>
      18. <td colspan="2"><input type="submit" name="Submit" value="{$button_submit}"></td>
      19. </tr>
      20. </table>
      21. </form>
      22. {/if}{/nocache}
      23. <table width="450">
      24. <tr>
      25. <th colspan="5">{$nws_news}</thd>
      26. </tr>
      27. <tr>
      28. <td>{$nws_id}</td>
      29. <td>{$nws_title}</td>
      30. <td>{$nws_date}</td>
      31. <td>{$nws_from}</td>
      32. <td>{$nws_del}</td>
      33. </tr>
      34. {foreach name=NewsList item=NewsRow from=$NewsList}<tr>
      35. <td><a href="?page=news&action=edit&id={$NewsRow.id}">{$NewsRow.id}</a></td>
      36. <td><a href="?page=news&action=edit&id={$NewsRow.id}">{$NewsRow.title}</a></td>
      37. <td><a href="?page=news&action=edit&id={$NewsRow.id}">{$NewsRow.date}</a></td>
      38. <td><a href="?page=news&action=edit&id={$NewsRow.id}">{$NewsRow.user}</a></td>
      39. <td><a href="?page=news&action=delete&id={$NewsRow.id}" onclick="return confirm('{$NewsRow.confirm}');"><img border="0" src="./styles/resource/images/alliance/CLOSE.png" width="16" height="16"></a></td>
      40. </tr>
      41. {/foreach}
      42. <tr><td colspan="5"><a href="?page=news&action=create">{$nws_create}</a></td></tr>
      43. <tr><td colspan="5">{$nws_total}</td></tr>
      44. </table>
      45. {include file="overall_footer.tpl"}
      Display All

      the sql table jobs looks like this

      SQL-Query

      1. CREATE TABLE IF NOT EXISTS `uni1_jobs` (
      2. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      3. `date` int(11) NOT NULL,
      4. `title` varchar(64) CHARACTER SET utf8 NOT NULL,
      5. `text` text CHARACTER SET utf8 NOT NULL,
      6. `catID` int(11) NOT NULL DEFAULT '1',
      7. `is_active` int(11) NOT NULL DEFAULT '1',
      8. PRIMARY KEY (`id`)
      9. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


      thanks for help
    • А поподробней можно? А то в переводе видимо потерялся какой то момент и не совсем понимаю что вам нужно
      Есть вопросы? спроси. Нужен мод? закажи :D
    • aurum79 wrote:

      А поподробней можно? А то в переводе видимо потерялся какой то момент и не совсем понимаю что вам нужно

      what I mean is how can I change showNewsPage.php, which I can create jobs (ShowJobsPage.php) which can then be displayed to me like the news

      Hiring translator ......
      Hiring Stuff Member .......

      The post was edited 1 time, last by Darkside ().

    • u have to add a case in the admin.php

      PHP Source Code

      1. case 'jobs':
      2. include_once('includes/pages/adm/ShowJobsPage.php');
      3. ShowJobsPage();
      4. break;


      add this to ur styles/templates/adm/showmenupage.tpl

      Source Code

      1. {if allowedTo('ShowJobsPage')}<li><a href="?page=jobs" target="Hauptframe">jobs</a></li>{/if}
      and copy the files to their destinstion.
      tlp to styles/templates/adm/*.tpl
      and php to includes/pages/adm/*.php

      and the sql


      Source Code

      1. CREATE TABLE IF NOT EXISTS `uni1_jobs` (
      2. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      3. `user` varchar(64) NOT NULL,
      4. `date` int(11) NOT NULL,
      5. `title` varchar(64) NOT NULL,
      6. `text` text NOT NULL,
      7. `catID` int(11) NOT NULL DEFAULT '1',
      8. `is_active` int(11) NOT NULL DEFAULT '1',
      9. PRIMARY KEY (`id`)
      10. ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
      11. INSERT INTO `uni1_jobs` (`id`, `user`, `date`, `title`, `text`, `catID`, `is_active`) VALUES
      12. (1, '1', 0, 'hallo welt', 'hallo welt test', 1, 1);
      Display All


      now u can start working at the jobcenter :)
      Files
      • jobs adm.zip

        (2.53 kB, downloaded 8 times, last: )
    • mimikri wrote:

      u have to add a case in the admin.php

      PHP Source Code

      1. case 'jobs':
      2. include_once('includes/pages/adm/ShowJobsPage.php');
      3. ShowJobsPage();
      4. break;
      that was missing with me

      but i must made some modification

      in JobsPage.tpl i have

      HTML Source Code

      1. {include file="head_nav.tpl"}
      on top

      all lines with

      HTML Source Code

      1. href="?page=news&amp


      must be changed to


      Source Code

      1. href="?page=jobs&amp
      and ......

      all is working


      Thanks mate