Example #1
0
 /**
  * Creates a new WikiItem for a given path and type.  If path already exists, return null.
  * Otherwise, return the new WikiItem.
  * @param string $strPath
  * @param integer $intWikiItemTypeId
  * @return WikiItem
  */
 public static function CreateNewItem($strPath, $intWikiItemTypeId)
 {
     // Make sure the path doesn't yet exist
     $strPath = self::SanitizeForPath($strPath, $intId);
     if (WikiItem::LoadByPathWikiItemTypeId($strPath, $intWikiItemTypeId)) {
         return null;
     }
     $objWikiItem = new WikiItem();
     $objWikiItem->Path = $strPath;
     $objWikiItem->WikiItemTypeId = $intWikiItemTypeId;
     $objWikiItem->EditorMinimumPersonTypeId = PersonType::RegisteredUser;
     $objWikiItem->Save();
     $objWikiItem->CreateTopicAndTopicLink();
     return $objWikiItem;
 }