Esempio n. 1
0
void Not_RemoveNotice (void)
  {
   char Query[512];
   long NotCod;

   /***** Get the code of the notice to remove *****/
   NotCod = Not_GetParamNotCod ();

   /***** Remove notice *****/
   /* Copy notice to table of deleted notices */
   sprintf (Query,"INSERT IGNORE INTO notices_deleted (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
                  " SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
                  " FROM notices"
                  " WHERE NotCod='%ld' AND CrsCod='%ld'",
            NotCod,Gbl.CurrentCrs.Crs.CrsCod);
   DB_QueryINSERT (Query,"can not remove notice");

   /* Remove notice */
   sprintf (Query,"DELETE FROM notices"
	          " WHERE NotCod='%ld' AND CrsCod='%ld'",
            NotCod,Gbl.CurrentCrs.Crs.CrsCod);
   DB_QueryDELETE (Query,"can not remove notice");

   /***** Mark possible notifications as removed *****/
   Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod);

   /***** Mark possible social note as unavailable *****/
   Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NOTE_NOTICE,NotCod);

   /***** Update RSS of current course *****/
   RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
  }
Esempio n. 2
0
static void Net_GetMyWebsAndSocialNetsFromForm (void)
  {
   Net_WebsAndSocialNetworks_t NumURL;
   char ParamName[3 + 10 + 1];
   char URL[Cns_MAX_BYTES_WWW + 1];

   /***** Get URLs *****/
   for (NumURL = (Net_WebsAndSocialNetworks_t) 0;
	NumURL < Net_NUM_WEBS_AND_SOCIAL_NETWORKS;
	NumURL++)
     {
      /***** Get URL from the form *****/
      snprintf (ParamName,sizeof (ParamName),
		"URL%u",
		(unsigned) NumURL);
      Par_GetParToText (ParamName,URL,Cns_MAX_BYTES_WWW);

      if (URL[0])
	 /***** Insert or replace web / social network *****/
	 DB_QueryREPLACE ("can not update user's web / social network",
			  "REPLACE INTO usr_webs"
			  " (UsrCod,Web,URL)"
			  " VALUES"
			  " (%ld,'%s','%s')",
			  Gbl.Usrs.Me.UsrDat.UsrCod,
			  Net_WebsAndSocialNetworksDB[NumURL],
			  URL);
      else
	 /***** Remove web / social network *****/
	 DB_QueryDELETE ("can not remove user's web / social network",
			 "DELETE FROM usr_webs WHERE UsrCod=%ld AND Web='%s'",
			 Gbl.Usrs.Me.UsrDat.UsrCod,
			 Net_WebsAndSocialNetworksDB[NumURL]);
     }
  }
Esempio n. 3
0
void Ban_RemoveBanner (void)
  {
   extern const char *Txt_Banner_X_removed;

   /***** Banner constructor *****/
   Ban_EditingBannerConstructor ();

   /***** Get banner code *****/
   if ((Ban_EditingBan->BanCod = Ban_GetParamBanCod ()) == -1L)
      Lay_ShowErrorAndExit ("Code of banner is missing.");

   /***** Get data of the banner from database *****/
   Ban_GetDataOfBannerByCod (Ban_EditingBan);

   /***** Remove banner *****/
   DB_QueryDELETE ("can not remove a banner",
		   "DELETE FROM banners WHERE BanCod=%ld",
		   Ban_EditingBan->BanCod);

   /***** Write message to show the change made *****/
   Ale_CreateAlert (Ale_SUCCESS,NULL,
	            Txt_Banner_X_removed,
                    Ban_EditingBan->ShrtName);
  }