phpMyFAQ PHP Cross Reference Customer Relationship Management

Source: /admin/record.show.php - 577 lines - 23789 bytes - Summary - Text - Print

Description: Shows the list of records ordered by categories

   1  <?php
   2  /**
   3   * Shows the list of records ordered by categories
   4   *
   5   * PHP Version 5.3
   6   *
   7   * This Source Code Form is subject to the terms of the Mozilla Public License,
   8   * v. 2.0. If a copy of the MPL was not distributed with this file, You can
   9   * obtain one at http://mozilla.org/MPL/2.0/.
  10   *
  11   * @category  phpMyFAQ
  12   * @package   Administration
  13   * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
  14   * @author    Minoru TODA <todam@netjapan.co.jp>
  15   * @copyright 2003-2014 phpMyFAQ Team
  16   * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
  17   * @link      http://www.phpmyfaq.de
  18   * @since     2003-02-23
  19   */
  20  
  21  if (!defined('IS_VALID_PHPMYFAQ')) {
  22      $protocol = 'http';
  23      if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
  24          $protocol = 'https';
  25      }
  26      header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
  27      exit();
  28  }
  29  
  30  printf(
  31      '<header><h2><i class="icon-pencil"></i> %s</h2><header>',
  32      $PMF_LANG['ad_entry_aor']
  33  );
  34  
  35  if ($permission['editbt'] || $permission['delbt']) {
  36  
  37      $category = new PMF_Category($faqConfig, array(), false);
  38      $category->setUser($currentAdminUser);
  39      $category->setGroups($currentAdminGroups);
  40      $category->transform(0);
  41      
  42      // Set the Category for the helper class
  43      $categoryHelper = new PMF_Helper_Category();
  44      $categoryHelper->setCategory($category);
  45  
  46      $category->buildTree();
  47      
  48      $linkverifier = new PMF_Linkverifier($faqConfig, $user->getLogin());
  49      if ($linkverifier->isReady()) {
  50  ?>
  51      <script type="text/javascript">
  52          <!--
  53          function getImageElement(id, lang)
  54          {
  55              return $('#imgurl_' + lang + '_' + id);
  56          }
  57  
  58          function getSpanElement(id, lang)
  59          {
  60              return $('#spanurl_' + lang + '_' + id);
  61          }
  62  
  63          function getDivElement(id, lang)
  64          {
  65              return $('#divurl_' + lang + '_' + id);
  66          }
  67  
  68          function onDemandVerifyURL(id, lang, target)
  69          {
  70              var target = getSpanElement(id, lang);
  71              var widthPx  = 780;
  72              var heigthPx = 450;
  73              var leftPx   = (screen.width  - widthPx)/2;
  74              var topPx    = (screen.height - heigthPx)/2;
  75              Fenster = window.open('index.php?action=ajax&ajax=onDemandURL&id=' + id + '&artlang=' + lang, 'onDemandURLVerification', 'toolbar=no, location=no, status=no, menubar=no, width=' + widthPx + ', height=' + heigthPx + ', left=' + leftPx + ', top=' + topPx + ', resizable=yes, scrollbars=yes');
  76              Fenster.focus();
  77  
  78              verifyEntryURL(id, lang);
  79          }
  80  
  81          function verifyEntryURL(id, lang)
  82          {
  83              //var target = getImageElement(id, lang);
  84              var target = getSpanElement(id, lang);
  85  
  86              // !!IMPORTANT!! DISABLE ONLOAD. If you do not do this, you will get infinite loop!
  87              getImageElement(id, lang).onload = "";
  88  
  89              //target.src = "images/url-checking.png";
  90              getDivElement(id, lang).className = "url-checking";
  91              target.innerHTML = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-checking']); ?>";
  92  
  93              var url = 'index.php';
  94              var pars = 'action=ajax&ajax=verifyURL&id=' + id + '&artlang=' + lang;
  95              var myAjax = new jQuery.ajax({url: url,
  96                  type: 'get',
  97                  data: pars,
  98                  complete: verifyEntryURL_success,
  99                  error: verifyEntryURL_failure});
 100  
 101              function verifyEntryURL_success(XmlRequest)
 102              {
 103                  //target.src = "images/url-" + XmlRequest.responseText + ".png";
 104                  var allResponses = new Array();
 105                  allResponses['batch1'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-batch1']); ?>";
 106                  allResponses['batch2'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-batch2']); ?>";
 107                  allResponses['batch3'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-batch3']); ?>";
 108                  allResponses['checking'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-checking']); ?>";
 109                  allResponses['disabled'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-disabled']); ?>";
 110                  allResponses['linkbad'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-linkbad']); ?>";
 111                  allResponses['linkok'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-linkok']); ?>";
 112                  allResponses['noaccess'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-noaccess']); ?>";
 113                  allResponses['noajax'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-noajax']); ?>";
 114                  allResponses['nolinks'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-nolinks']); ?>";
 115                  allResponses['noscript'] = "<?php print($PMF_LANG['ad_linkcheck_feedback_url-noscript']); ?>";
 116                  getDivElement(id, lang).className = "url-" + XmlRequest.responseText;
 117                  if (typeof(allResponses[XmlRequest.responseText]) == "undefined") {
 118                      getDivElement(id, lang).className = "url-noajax ";
 119                      target.html(allResponses['noajax']);
 120                  } else {
 121                      target.html(allResponses[XmlRequest.responseText]);
 122                  }
 123              }
 124  
 125              function verifyEntryURL_failure(XmlRequest)
 126              {
 127                  getDivElement(id, lang).className = "url-noaccess";
 128                  target.html("<?php print($PMF_LANG['ad_linkcheck_feedback_url-noaccess']); ?>");
 129              }
 130  
 131          }
 132          //-->
 133      </script>
 134  <?php
 135      }
 136  
 137      $comment = new PMF_Comment($faqConfig);
 138      $faq     = new PMF_Faq($faqConfig);
 139      $date    = new PMF_Date($faqConfig);
 140  
 141      $internalSearch = '';
 142      $linkState      = PMF_Filter::filterInput(INPUT_POST, 'linkstate', FILTER_SANITIZE_STRING);
 143      $searchCat      = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
 144      $searchTerm     = PMF_Filter::filterInput(INPUT_POST, 'searchterm', FILTER_SANITIZE_STRIPPED);
 145  
 146      if (!is_null($linkState)) {
 147          $cond[PMF_Db::getTablePrefix() . 'faqdata.links_state'] = 'linkbad';
 148          $linkState                             = ' checked="checked" ';
 149          $internalSearch                       .= '&amp;linkstate=linkbad';
 150      }
 151      if (!is_null($searchCat)) {
 152          $internalSearch .= "&amp;searchcat=" . $searchCat;
 153          $cond[PMF_Db::getTablePrefix() . 'faqcategoryrelations.category_id'] = array_merge(
 154              array($searchCat),
 155              $category->getChildNodes($searchCat)
 156          );
 157      }
 158  
 159      $selectedCategory = PMF_Filter::filterInput(INPUT_GET, 'category', FILTER_VALIDATE_INT, 0);
 160      $orderBy          = PMF_Filter::filterInput(INPUT_GET, 'orderby', FILTER_SANITIZE_STRING, 1);
 161      $sortBy           = PMF_Filter::filterInput(INPUT_GET, 'sortby', FILTER_SANITIZE_STRING);
 162      if (1 !== $orderBy) {
 163          switch ($orderBy) {
 164              case 'id':
 165                  $orderBy = 1;
 166                  break;
 167              case 'title':
 168                  $orderBy = 2;
 169                  break;
 170              case 'date':
 171                  $orderBy = 3;
 172                  break;
 173          }
 174      }
 175  ?>
 176      <form id="recordSelection" name="recordSelection" method="post" accept-charset="utf-8">
 177  <?php
 178      $numCommentsByFaq = $comment->getNumberOfComments();
 179      $numRecordsByCat  = $category->getNumberOfRecordsOfCategory();
 180  
 181      $matrix = $category->getCategoryRecordsMatrix();
 182      foreach ($matrix as $catkey => $value) {
 183          $numCommentsByCat[$catkey] = 0;
 184          foreach ($value as $faqkey => $value) {
 185              if (isset($numCommentsByFaq[$faqkey])) {
 186                  $numCommentsByCat[$catkey] += $numCommentsByFaq[$faqkey];
 187              }
 188          }
 189      }
 190  
 191      if (is_null($searchTerm)) {
 192  
 193          $faq->getAllRecords($orderBy, null, $sortBy);
 194          foreach ($faq->faqRecords as $record) {
 195              if (!isset($numActiveByCat[$record['category_id']])) {
 196                  $numActiveByCat[$record['category_id']] = 0;
 197              }
 198              $numActiveByCat[$record['category_id']] += $record['active'] == 'yes' ? 1 : 0;
 199          }
 200  
 201      } else {
 202  
 203          $fdTable  = PMF_Db::getTablePrefix() . 'faqdata';
 204          $fcrTable = PMF_Db::getTablePrefix() . 'faqcategoryrelations';
 205          $search   = PMF_Search_Factory::create($faqConfig, array('database' => PMF_Db::getType()));
 206  
 207          $search->setTable($fdTable)
 208              ->setResultColumns(array(
 209                      $fdTable . '.id AS id',
 210                      $fdTable . '.lang AS lang',
 211                      $fdTable . '.solution_id AS solution_id',
 212                      $fcrTable . '.category_id AS category_id',
 213                      $fdTable . '.sticky AS sticky',
 214                      $fdTable . '.active AS active',
 215                      $fdTable . '.thema AS thema',
 216                      $fdTable . '.content AS content',
 217                      $fdTable . '.datum AS date'))
 218              ->setJoinedTable($fcrTable)
 219              ->setJoinedColumns(array(
 220                      $fdTable . '.id = ' . $fcrTable . '.record_id',
 221                      $fdTable . '.lang = ' . $fcrTable . '.record_lang'));
 222  
 223          if (is_numeric($searchTerm)) {
 224              $search->setMatchingColumns(array($fdTable . '.solution_id'));
 225          } else {
 226              $search->setMatchingColumns(array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords'));
 227          }
 228  
 229          $result         = $search->search($searchTerm);
 230          $laction        = 'view';
 231          $internalSearch = '&amp;search='.$searchTerm;
 232          $wasSearch      = true;
 233          $idsFound       = array();
 234          $faqsFound      = array();
 235  
 236          while ($row = $faqConfig->getDb()->fetchObject($result)) {
 237  
 238              if ($searchCat != 0 && $searchCat != (int)$row->category_id) {
 239                  continue;
 240              }
 241  
 242              if (in_array($row->id, $idsFound)) {
 243                  continue; // only show one entry if FAQ is in mulitple categories
 244              }
 245  
 246              $faqsFound[$row->category_id][$row->id] = array(
 247                  'id'          => $row->id,
 248                  'category_id' => $row->category_id,
 249                  'solution_id' => $row->solution_id,
 250                  'lang'        => $row->lang,
 251                  'active'      => $row->active,
 252                  'sticky'      => $row->sticky,
 253                  'title'       => $row->thema,
 254                  'content'     => $row->content,
 255                  'date'        => PMF_Date::createIsoDate($row->date)
 256              );
 257  
 258              if (!isset($numActiveByCat[$row->category_id])) {
 259                  $numActiveByCat[$row->category_id] = 0;
 260              }
 261  
 262              $numActiveByCat[$row->category_id] += $row->active ? 1 : 0;
 263  
 264              $idsFound[] = $row->id;
 265          }
 266  
 267          // Sort search result ordered by category ID
 268          ksort($faqsFound);
 269          foreach ($faqsFound as $categoryId => $faqFound) {
 270              foreach ($faqFound as $singleFaq) {
 271                  $faq->faqRecords[] = $singleFaq;
 272              }
 273          }
 274  
 275      }
 276  
 277      if (count($faq->faqRecords) > 0) {
 278          $old    = 0;
 279          $faqIds = array();
 280  
 281          $visits    = new PMF_Visits($faqConfig);
 282          $numVisits = array();
 283          foreach ($visits->getAllData() as $visit) {
 284              $numVisits[$visit['id']] = $visit['lang'];
 285          }
 286          
 287          foreach ($faq->faqRecords as $record) {
 288              $catInfo =  '';
 289              $cid     = $record['category_id'];
 290              
 291              if (isset($numRecordsByCat[$cid]) && ($numRecordsByCat[$cid] > 0)) {
 292                  $catInfo .= sprintf(
 293                      '<span class="label label-info" id="category_%d_item_count">%d %s</span> ',
 294                      $cid, 
 295                      $numRecordsByCat[$cid], 
 296                      $PMF_LANG['msgEntries']
 297                  );
 298              }
 299              
 300              if (isset($numRecordsByCat[$cid]) && $numRecordsByCat[$cid] > $numActiveByCat[$cid]) {
 301                  $catInfo .= sprintf(
 302                      '<span class="label label-important"><span id="js-active-records-%d">%d</span> %s</span> ',
 303                      $cid,
 304                      $numRecordsByCat[$cid] - $numActiveByCat[$cid],
 305                      $PMF_LANG['ad_record_inactive']
 306                  );
 307              }
 308              
 309              if (isset($numCommentsByCat[$cid]) && ($numCommentsByCat[$cid] > 0)) {
 310                  $catInfo .= sprintf('<span class="label label-inverse">%d %s</span>',
 311                      $numCommentsByCat[$cid],
 312                      $PMF_LANG['ad_start_comments']
 313                  );
 314              }
 315              $catInfo .= '';
 316              
 317              if ($cid != $old) {
 318                  if ($old == 0) {
 319                      printf('<a name="cat_%d"></a>', $cid);
 320                  } else {
 321                      print "        </tbody>\n        </table>\n        </div>";
 322                  }
 323  ?>
 324          <p>
 325              <a class="btn showhideCategory" data-category-id="<?php echo $cid; ?>">
 326                  <i class="icon icon-arrow-right"></i>
 327                  <strong><?php echo $category->getPath($cid); ?></strong> <?php echo $catInfo;?>
 328              </a>
 329          </p>
 330          <div id="category_<?php print $cid; ?>" class="categorybox <?php print ($selectedCategory == $cid) ? '' : 'hide'; ?>">
 331          <table class="table table-striped">
 332          <thead>
 333          <tr>
 334              <th colspan="2" style="width: 24px;">
 335                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=id&amp;sortby=desc">
 336                      &uarr;
 337                  </a>
 338                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=id&amp;sortby=asc">
 339                      &darr;
 340                  </a>
 341              </th>
 342              <th>
 343                  #
 344              </th>
 345              <th style="width: 72px;">
 346                  <input type="checkbox" id="sticky_category_block_<?php print $cid; ?>"
 347                         onclick="saveStatusForCategory(<?php print $cid; ?>, 'sticky')" />
 348                  &nbsp;<?php echo $PMF_LANG['ad_record_sticky'] ?>
 349              </th>
 350              <th style="width: 84px;">
 351                  <?php if ($permission['approverec']) { ?>
 352                  <input type="checkbox" id="active_category_block_<?php print $cid; ?>"
 353                         onclick="saveStatusForCategory(<?php print $cid; ?>, 'active')"
 354                         <?php echo ($numRecordsByCat[$cid] == $numActiveByCat[$cid] ? 'checked="checked"' : '') ?>>
 355                  &nbsp;<?php echo $PMF_LANG['ad_record_active'] ?>
 356                  <?php } ?>
 357              </th>
 358              <th>
 359                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=title&amp;sortby=desc">
 360                      &uarr;
 361                  </a>
 362                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=title&amp;sortby=asc">
 363                      &darr;
 364                  </a>
 365              </th>
 366              <th>
 367                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=date&amp;sortby=desc">
 368                      &uarr;
 369                  </a>
 370                  <a href="?action=view&amp;category=<?php print $cid; ?>&amp;orderby=date&amp;sortby=asc">
 371                      &darr;
 372                  </a>
 373              </th>
 374              <th colspan="3">
 375                  &nbsp;
 376              </th>
 377          </tr>
 378          </thead>
 379          <tbody>
 380  <?php
 381              }
 382  ?>
 383          <tr id="record_<?php echo $record['id'] . '_' . $record['lang']; ?>">
 384              <td style="width: 24px; text-align: right;">
 385                  <a href="?action=editentry&amp;id=<?php print $record['id']; ?>&amp;lang=<?php print $record['lang']; ?>">
 386                      <?php print $record['id']; ?>
 387                  </a>
 388              </td>
 389              <td style="width: 16px;">
 390                  <?php print $record['lang']; ?>
 391              </td>
 392              <td style="width: 24px;">
 393                  <a href="?action=editentry&amp;id=<?php print $record['id']; ?>&amp;lang=<?php print $record['lang']; ?>"
 394                     title="<?php print $PMF_LANG["ad_user_edit"]; ?> '<?php print str_replace("\"", "´", $record['title']); ?>'">
 395                      <?php print $record['solution_id']; ?>
 396                  </a>
 397              </td>
 398              <td style="width: 56px;">
 399                  <input type="checkbox" lang="<?php print $record['lang'] ?>"
 400                         onclick="saveStatus(<?php print $cid . ', [' . $record['id'] . ']' ?>, 'sticky');"
 401                         id="sticky_record_<?php print $cid . '_' . $record['id'] ?>"
 402                      <?php $record['sticky'] ? print 'checked="checked"' : print '    ' ?> />
 403              </td>
 404              <td>
 405                  <?php if ($permission['approverec'] && isset($numVisits[$record['id']])) { ?>
 406                  <input type="checkbox" lang="<?php print $record['lang'] ?>"
 407                         onclick="saveStatus(<?php print $cid . ', [' . $record['id'] . ']' ?>, 'active');"
 408                         id="active_record_<?php print $cid . '_' . $record['id'] ?>"
 409                      <?php 'yes' == $record['active'] ? print 'checked="checked"' : print '    ' ?> />
 410                  <?php }  else { ?>
 411                  <span class="label label-important"><i class="icon-white icon-ban-circle"></i></span>
 412                  <?php } ?>
 413              </td>
 414              <td>
 415                  <a href="?action=editentry&amp;id=<?php print $record['id']; ?>&amp;lang=<?php print $record['lang']; ?>"
 416                     title="<?php print $PMF_LANG["ad_user_edit"]; ?> '<?php print str_replace("\"", "´", $record['title']); ?>'">
 417                      <?php print $record['title']; ?>
 418                  </a>
 419  <?php
 420          if (isset($numCommentsByFaq[$record['id']])) {
 421              printf(
 422                  '<br/><a class="label label-inverse" href="?action=comments#record_id_%d">%d %s</a>',
 423                  $record['id'],
 424                  $numCommentsByFaq[$record['id']],
 425                  $PMF_LANG['ad_start_comments']
 426                  );
 427          }
 428  ?></td>
 429              <td style="width: 48px;">
 430                  <?php print $date->format($record['date']); ?>
 431              </td>
 432              <td style="width: 96px;">
 433                  <?php print $linkverifier->getEntryStateHTML($record['id'], $record['lang']); ?>
 434              </td>
 435              <td style="width: 16px;">
 436                  <a class="btn btn-info" href="?action=copyentry&amp;id=<?php print $record['id']; ?>&amp;lang=<?php print $record['lang']; ?>"
 437                     title="<?php print $PMF_LANG['ad_categ_copy']; ?>">
 438                      <i class="icon-share"></i>
 439                  </a>
 440              </td>
 441              <td style="width: 16px;">
 442                  <a class="btn btn-danger" href="javascript:void(0);"
 443                     onclick="javascript:deleteRecord(<?php print $record['id']; ?>, '<?php print $record['lang']; ?>'); return false;"
 444                     title="<?php print $PMF_LANG["ad_user_delete"]; ?>">
 445                      <i class="icon-trash"></i>
 446                  </a>
 447              </td>
 448          </tr>
 449  <?php
 450              $old = $cid;
 451              
 452              $faqIds[$cid][] = $record['id'];
 453          }
 454  ?>
 455          </tbody>
 456          </table>
 457          </div>
 458          </form>
 459  
 460          <script type="text/javascript" src="assets/js/record.js"></script>
 461          <script type="text/javascript">
 462          /* <![CDATA[ */
 463  
 464          /**
 465           * Saves the sticky record status for the whole category
 466           *
 467           * @param id   id
 468           * @param type status type
 469           *
 470           * @return void
 471           */
 472          function saveStatusForCategory(id, type)
 473          {
 474              var id_map = [];
 475  <?php 
 476  foreach ($faqIds as $categoryId => $recordIds) {
 477      if ('' === $categoryId) {
 478          $categoryId = 0;
 479      }
 480      echo "                id_map[" . $categoryId . "] = [" . implode(',', $recordIds) . "];\n";
 481  }
 482  ?>
 483              for (var i = 0; i < id_map[id].length; i++) {
 484                  var status = $('#' + type + '_category_block_' + id).prop('checked');
 485                  $('#' + type + '_record_' + id + '_' + id_map[id][i]).prop('checked', status);
 486              }
 487  
 488              saveStatus(id, id_map[id], type);
 489          }
 490  
 491          /**
 492           * Ajax call for saving the sticky record status
 493           *
 494           * @param cid  category id
 495           * @param ids  ids
 496           * @param type status type
 497           *
 498           * @return void
 499           */
 500          function saveStatus(cid, ids, type)
 501          {
 502              $('#saving_data_indicator').html('<img src="images/indicator.gif" /> saving ...');
 503              var data = {action: "ajax", ajax: 'records', ajaxaction: "save_" + type + "_records"};
 504  
 505              for (var i = 0; i < ids.length; i++) {
 506                  var statusId = '#' + type + '_record_' + cid + '_' + ids[i];
 507                  var status   = $(statusId).attr('checked') ? '' : 'checked';
 508                  var langId   = '#' + type + '_record_' + cid + '_' + ids[i];
 509                  var lang     = $(langId).attr('lang');
 510  
 511                  data['items[' + i + '][]'] = [ids[i], lang, status];
 512  
 513                  // Updating the current record if it's also contained in another category
 514                  var same_records = $('input').filter(function() {
 515                      return this.id.match(new RegExp(type + '_record_(\\d+)_' + ids[i]));
 516                  });
 517  
 518                  if ('active' === type) {
 519                      for (var j = 0; j < same_records.length; j++) {
 520                          $('#' + same_records[j].id).attr('checked', status);
 521  
 522                          var catid              = same_records[j].id.match(/active_record_(\d+)_\d+/)[1];
 523                          var current_item_count = $('#js-active-records-' + catid).html();
 524                          var delta              = 'checked' === status ? -1 : 1;
 525  
 526                          $('#js-active-records-' + catid).html(current_item_count * 1 + delta);
 527                      }
 528                  } else {
 529                      for (var j = 0; j < same_records.length; j++) {
 530                          $('#' + same_records[j].id).attr('checked', status);
 531  
 532                          var catid              = same_records[j].id.match(/active_record_(\d+)_\d+/)[1];
 533                          var current_item_count = $('#js-active-records-' + catid).html();
 534                          var delta              = 'checked' === status ? -1 : 1;
 535  
 536                          $('#js-active-records-' + catid).html(current_item_count * 1 + delta);
 537                      }
 538                  }
 539              }
 540  
 541              $.get("index.php", data, null);
 542              $('#saving_data_indicator').html('<?php print $PMF_LANG['ad_entry_savedsuc']; ?>');
 543          }
 544  
 545          /**
 546           * Ajax call for deleting records
 547           *
 548           * @param record_id   Record id
 549           * @param record_lang Record language
 550           *
 551           * @return void
 552           */
 553          function deleteRecord(record_id, record_lang)
 554          {
 555              if (confirm('<?php print addslashes($PMF_LANG["ad_entry_del_1"] . " " . $PMF_LANG["ad_entry_del_3"]); ?>')) {
 556                  $('#saving_data_indicator').html('<img src="images/indicator.gif" /> deleting ...');
 557                  $.ajax({
 558                      type:    "POST",
 559                      url:     "index.php?action=ajax&ajax=records&ajaxaction=delete_record",
 560                      data:    "record_id=" + record_id + "&record_lang=" + record_lang,
 561                      success: function(msg) {
 562                          $("#record_" + record_id + "_" + record_lang).fadeOut("slow");
 563                          $('#saving_data_indicator').html('<?php print $PMF_LANG['ad_entry_delsuc']; ?>');
 564                      }
 565                  });
 566              }
 567          }
 568  
 569          /* ]]> */
 570          </script>
 571  <?php
 572      } else {
 573          print $PMF_LANG['err_nothingFound'];
 574      }
 575  } else {
 576      print $PMF_LANG['err_NotAuth'];
 577  }

title

Description

title

Description

title

Description

title

title

Body