[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/system/ -> custom_field_editor.php (source)

   1  <?php /* $Id: custom_field_editor.php 141 2008-04-05 16:41:20Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/system/custom_field_editor.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  /*
   7  *    Custom Field Editor (NEW)
   8  *
   9  */
  10  
  11  // check permissions
  12  $perms = &$AppUI->acl();
  13  if (!$perms->checkModule('system', 'edit')) {
  14      $AppUI->redirect('m=public&a=access_denied');
  15  }
  16  
  17  $AppUI->savePlace();
  18  
  19  require_once ($AppUI->getSystemClass('CustomFields'));
  20  $yesno = w2PgetSysVal('GlobalYesNo');
  21  $html_types = array('textinput' => $AppUI->_('Text Input'), 'textarea' => $AppUI->_('Text Area'), 'checkbox' => $AppUI->_('Checkbox'), 'select' => $AppUI->_('Select List'), 'label' => $AppUI->_('Label'), 'separator' => $AppUI->_('Separator'), 'href' => $AppUI->_('Weblink'), );
  22  
  23  $titleBlock = new CTitleBlock('Custom field editor', 'customfields.png', 'admin', 'admin.custom_field_editor');
  24  $titleBlock->addCrumb('?m=system', 'system admin');
  25  
  26  $edit_field_id = w2PGetParam($_POST, 'field_id', null);
  27  
  28  $titleBlock->show();
  29  
  30  $q = new DBQuery;
  31  $q->addTable('modules');
  32  $q->addOrder('mod_ui_order');
  33  $q->addWhere('mod_name IN (\'Companies\', \'Projects\', \'Tasks\', \'Calendar\', \'Contacts\')');
  34  $modules = $q->loadList();
  35  $q->clear();
  36  
  37  $s = '<table width="100%" class="std" cellpadding="2">';
  38  
  39  foreach ($modules as $module) {
  40      $s .= '<tr valign="bottom"><td colspan="4">';
  41      $s .= '<h3><span title="' . $AppUI->_('Add Custom Field') . '::' . $AppUI->_('Click this icon to Add a new Custom Field to this Module.') . '"><a href="?m=system&a=custom_field_addedit&module=' . $module['mod_name'] . '"><img src="' . w2PfindImage('icons/edit_add.png') . '" align="center" width="16" height="16" border="0"></a></span>';
  42      $s .= $AppUI->_($module['mod_name']) . '</h3>';
  43      $s .= '</td></tr>';
  44  
  45      $q = new DBQuery;
  46      $q->addTable('custom_fields_struct');
  47      $q->addWhere('field_module = \'' . strtolower($module['mod_name']) . '\'');
  48      $q->addOrder('field_order ASC');
  49      $custom_fields = $q->loadList();
  50      $q->clear();
  51  
  52      if (count($custom_fields)) {
  53          $s .= '<th width="10"></th>';
  54          $s .= '<th width="10"></th>';
  55          $s .= '<th>' . $AppUI->_('Name') . '</th>';
  56          $s .= '<th>' . $AppUI->_('Description') . '</th>';
  57          $s .= '<th>' . $AppUI->_('Type') . '</th>';
  58          $s .= '<th>' . $AppUI->_('Pub.') . '</th>';
  59          $s .= '<th>' . $AppUI->_('Order') . '</th>';
  60      }
  61  
  62      foreach ($custom_fields as $f) {
  63          $s .= '<tr><td class="hilite" width="10">';
  64          $s .= '<span title="' . $AppUI->_('Edit Custom Field') . '::' . $AppUI->_('Click this icon to Edit this Custom Field.') . '"><a href="?m=system&a=custom_field_addedit&module=' . $module['mod_name'] . '&field_id=' . $f['field_id'] . '"><img src="' . w2PfindImage('icons/stock_edit-16.png') . '" align="center" width="16" height="16" border="0"></a></span>';
  65          $s .= '</td><td class="hilite" width="10">';
  66          $s .= '<span title="' . $AppUI->_('Delete Custom Field') . '::' . $AppUI->_('Click this icon to Delete this Custom Field.') . '"><a href="?m=system&a=custom_field_addedit&field_id=' . $f['field_id'] . '&delete=1"><img src="' . w2PfindImage('icons/stock_delete-16.png') . '" align="center" width="16" height="16" border="0"></a> ';
  67          $s .= '<td class="hilite">';
  68          $s .= stripslashes($f['field_name']);
  69          $s .= '</td><td class="hilite">';
  70          $s .= stripslashes($f['field_description']);
  71          $s .= '</td><td class="hilite">';
  72          $s .= $html_types[$f['field_htmltype']];
  73          $s .= "</td><td class=\"hilite\">";
  74          $s .= $yesno[$f['field_published']];
  75          $s .= '</td><td class="hilite" style="text-align:right;">';
  76          $s .= stripslashes($f['field_order']);
  77          $s .= '</td></tr>';
  78      }
  79  }
  80  $s .= '</table>';
  81  echo $s;
  82  ?>


Generated: Thu Jan 8 03:00:03 2009 Cross-referenced by PHPXref 0.7