Пример #1
0
 public static function delete($ids)
 {
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $db = DevblocksPlatform::getDatabaseService();
     $id_list = implode(',', $ids);
     $sql = sprintf("DELETE QUICK FROM community WHERE id IN (%s)", $id_list);
     $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
     /* @var $rs ADORecordSet */
     // Community Tools
     $tools = DAO_CommunityTool::getWhere(sprintf("%s IN (%s)", DAO_CommunityTool::COMMUNITY_ID, $id_list));
     DAO_CommunityTool::delete(array_keys($tools));
     // [TODO] cascade foreign key constraints
 }
Пример #2
0
 function saveCommunityToolAction()
 {
     @($code = DevblocksPlatform::importGPC($_POST['portal'], 'string'));
     @($name = DevblocksPlatform::importGPC($_POST['portal_name'], 'string', ''));
     @($iDelete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
     UmPortalHelper::setCode($code);
     if (DEMO_MODE) {
         if ($iDelete) {
             DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
         } else {
             self::getCommunityToolAction();
         }
         return;
     }
     if (null != ($instance = DAO_CommunityTool::getByCode($code))) {
         // Deleting?
         if (!empty($iDelete)) {
             $tool = DAO_CommunityTool::getByCode($code);
             /* @var $tool Model_CommunityTool */
             DAO_CommunityTool::delete($tool->id);
             DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
             return;
         } else {
             $manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true);
             $tool = $manifest->createInstance();
             /* @var $tool Extension_UsermeetTool */
             // Update the tool name if it has changed
             if (0 != strcmp($instance->name, $name)) {
                 DAO_CommunityTool::update($instance->id, array(DAO_CommunityTool::NAME => $name));
             }
             // Defer the rest to tool instances and extensions
             $tool->saveConfiguration();
         }
     }
     self::getCommunityToolAction();
 }
Пример #3
0
 function saveCommunityToolAction()
 {
     @($code = DevblocksPlatform::importGPC($_POST['portal'], 'string'));
     @($iDelete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
     if (DEMO_MODE) {
         if ($iDelete) {
             DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
         } else {
             self::getCommunityToolAction();
         }
         return;
     }
     if (null != ($instance = DAO_CommunityTool::getByCode($code))) {
         // Deleting?
         if (!empty($iDelete)) {
             $tool = DAO_CommunityTool::getByCode($code);
             /* @var $tool Model_CommunityTool */
             DAO_CommunityTool::delete($tool->id);
             DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
             return;
         } else {
             $manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true);
             $tool = $manifest->createInstance();
             /* @var $tool Extension_UsermeetTool */
             $tool->setPortal($code);
             // [TODO] Kinda hacky
             $tool->saveConfiguration();
         }
     }
     self::getCommunityToolAction();
 }