Ejemplo n.º 1
0
 function validateName()
 {
     //Setup validation return array
     $validationResults = array('validatedOk' => true, 'errors' => array());
     //Check to see if the name is unique
     $widget = new ListWidget();
     $widget->name = $this->name;
     if ($this->id) {
         $widget->whereAdd("id != " . $this->id);
     }
     $widget->libraryId = $this->libraryId;
     $widget->find();
     if ($widget->N > 0) {
         //The title is not unique
         $validationResults['errors'][] = "This widget has already been created.  Please select another name.";
     }
     //Make sure there aren't errors
     if (count($validationResults['errors']) > 0) {
         $validationResults['validatedOk'] = false;
     }
     return $validationResults;
 }
 private function launchEdit($widgetId, $widgetListId)
 {
     global $configArray;
     global $interface;
     $interface->setPageTitle('List Widgets');
     //Get Info about the Widget
     $widget = new ListWidget();
     $widget->whereAdd('id = ' . $widgetId);
     $widget->find();
     $widget->fetch();
     $interface->assign('widgetName', $widget->name);
     $interface->assign('widgetId', $widget->id);
     //Get Info about the current TAB
     $widgetList = new ListWidgetList();
     $widgetList->whereAdd('id = ' . $widgetListId);
     $widgetList->find();
     $widgetList->fetch();
     $interface->assign('widgetListName', $widgetList->name);
     //Get all available links
     $availableLinks = array();
     $listWidgetLinks = new ListWidgetListsLinks();
     $listWidgetLinks->whereAdd('listWidgetListsId = ' . $widgetListId);
     $listWidgetLinks->orderBy('weight ASC');
     $listWidgetLinks->find();
     while ($listWidgetLinks->fetch()) {
         $availableLinks[$listWidgetLinks->id] = clone $listWidgetLinks;
     }
     $interface->assign('availableLinks', $availableLinks);
     $interface->setTemplate('listWidgetListLinks.tpl');
 }