function occindex($content = null) { if (is_array($content)) { if ($content['nm']['rows']['delete']) { list($id) = each($content['nm']['rows']['delete']); unset($content['nm']['rows']['delete']); if ($this->occ->delete(array('cp_occ_id' => $id))) { $content['msg'] = lang('Occurence deleted'); } else { $content['msg'] = lang('Delete failed!'); } } } else { $content['msg'] = $_GET['msg']; } // initializing of thwe nextmatch widget, through reading of stored sessiondata $content['nm'] = $GLOBALS['egw']->session->appsession('occ_session_data', 'courseprotocol'); $content['nm'] = array('get_rows' => 'courseprotocol.uicourseprotocol.get_rows_occ', 'filter_label' => '', 'filter_help' => '', 'no_filter' => True, 'no_filter2' => True, 'never_hide' => True, 'lettersearch' => False, 'searchletter' => '', 'start' => 0, 'order' => 'cp_occ_date', 'sort' => 'DESC', 'col_filter' => array(), 'default_cols' => '!cp_occ_analy'); $content['msg'] = $_GET['msg']; //_debug_array($content); $this->tmpl->read('courseprotocol.occindex'); $this->tmpl->set_cell_attribute('debuginfo', 'disabled', !$debug); $this->tmpl->set_cell_attribute('myhrule', 'disabled', !$separator); $this->tmpl->exec('courseprotocol.uicourseprotocol.occindex', $content, array('cp_occ_type' => $this->oc_types), array(), $preserv); // the debug info will be displayed at the very end of the page //_debug_array($content); }
function cell2widget($cell, &$spanned, $etempl, &$root, &$embeded_too) { $type = $cell['type']; if (is_array($type)) { list(, $type) = each($type); } if (substr($type, 0, 6) == 'select') { $type = $cell['size'] > 1 ? 'select-multi' : 'select'; } $widgetattr2xul = isset($this->widget2xul[$type]) ? $this->widget2xul[$type] : array(); $type = isset($widgetattr2xul['.name']) ? $widgetattr2xul['.name'] : $type; list($parent, $child, $child2) = explode(',', $type); $widget = new xmlnode($parent); $attr_widget =& $widget; if ($child) { $child = new xmlnode($child); $attr_widget =& $child; } if ($child2) { $child2 = new xmlnode($child2); } if (isset($widgetattr2xul['.set'])) { $attrs = explode(',', $widgetattr2xul['.set']); while (list(, $attr) = each($attrs)) { list($attr, $val) = explode('=', $attr); $widget->set_attribute($attr, $val); } } switch ($parent) { case 'nextmatch': list($tpl) = explode(',', $cell['size']); $embeded = new etemplate($tpl, $etempl->as_array()); if ($embeded_too) { $this->etempl2grid($embeded, $root, $embeded_too); } $cell['size'] = $embeded->name; unset($embeded); break; case 'tabbox': $labels = explode('|', $cell['label']); unset($cell['label']); $helps = explode('|', $cell['help']); unset($cell['help']); $names = explode('|', $cell['name']); unset($cell['name']); for ($n = 0; $n < count($labels); ++$n) { $tab = new xmlnode('tab'); $tab->set_attribute('label', $labels[$n]); $tab->set_attribute('statustext', $helps[$n]); $child->add_node($tab); $embeded = new etemplate($names[$n], $etempl->as_array()); if ($embeded_too) { $this->etempl2grid($embeded, $root, $embeded_too); } $grid = new xmlnode('grid'); $grid->set_attribute('id', $embeded->name); $child2->add_node($grid); unset($embeded); } break; case 'menulist': // id,options belongs to the 'menupopup' child if ($cell['span']) { $widget->set_attribute('span', $cell['span']); unset($cell['span']); } // fall-trought // fall-trought case 'listbox': if ($cell['type'] != 'select') { $attr_widget->set_attribute('type', $cell['type']); } break; case 'vbox': case 'hbox': list($anz, $options) = split(',', $cell['size'], 2); for ($n = 1; $n <= $anz; ++$n) { $widget->add_node($this->cell2widget($cell[$n], $no_span, $etempl, $root, $embeded_too)); unset($cell[$n]); } $cell['size'] = $options; break; case 'grid': if ($cell['name'][0] != '@' && $embeded_too) { $embeded = new etemplate(); if ($embeded->read($name = $embeded->expand_name($cell['name'], 0, 0), 'default', 'default', 0, '', $etempl->as_array())) { $this->etempl2grid($embeded, $root, $embeded_too); } $cell['name'] = $embeded->name; unset($embeded); } break; } while (list($attr, $val) = each($cell)) { if (is_array($val)) { list(, $val) = each($val); } if (isset($widgetattr2xul[$attr])) { $attr = $widgetattr2xul[$attr]; } elseif (isset($this->attr2xul[$attr])) { $attr = $this->attr2xul[$attr]; } $this->set_attributes2($attr_widget, $attr, $val, $spanned); } if ($child) { $widget->add_node($child); } if ($child2) { $widget->add_node($child2); } return $widget; }