コード例 #1
0
ファイル: swad_search.c プロジェクト: Amab/swad-core
static void Sch_SaveLastSearchIntoSession (void)
  {
   if (Gbl.Usrs.Me.Logged)
     {
      if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN)
	 Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;

      /***** Save last search in session *****/
      DB_QueryUPDATE ("can not update last search in session",
		      "UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'"
		      " WHERE SessionId='%s'",
		      (unsigned) Gbl.Search.WhatToSearch,
		      Gbl.Search.Str,
		      Gbl.Session.Id);

      /***** Update my last type of search *****/
      // WhatToSearch is stored in usr_last for next time I log in
      // In other existing sessions distinct to this, WhatToSearch will remain unchanged
      DB_QueryUPDATE ("can not update type of search in user's last data",
		      "UPDATE usr_last SET WhatToSearch=%u"
		      " WHERE UsrCod=%ld",
		      (unsigned) Gbl.Search.WhatToSearch,
		      Gbl.Usrs.Me.UsrDat.UsrCod);
     }
  }
コード例 #2
0
ファイル: swad_banner.c プロジェクト: Amab/swad-core
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
				 const char *NewBanName)
  {
   /***** Update banner changing old name by new name *****/
   DB_QueryUPDATE ("can not update the name of a banner",
		   "UPDATE banners SET %s='%s' WHERE BanCod=%ld",
	           FieldName,NewBanName,BanCod);
  }
コード例 #3
0
ファイル: swad_pagination.c プロジェクト: Amab/swad-core
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
  {
   /***** Save last page of received/sent messages *****/
   DB_QueryUPDATE ("can not update last page of messages",
		   "UPDATE sessions SET %s=%u WHERE SessionId='%s'",
                   WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
        	                                           "LastPageMsgSnt",
                   NumPage,Gbl.Session.Id);
  }
コード例 #4
0
ファイル: swad_notice.c プロジェクト: proxymoron/swad-core
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail)
  {
   char Query[512];

   /***** Update number of users notified *****/
   sprintf (Query,"UPDATE notices SET NumNotif='%u' WHERE NotCod='%ld'",
            NumUsrsToBeNotifiedByEMail,NotCod);
   DB_QueryUPDATE (Query,"can not update the number of notifications of a notice");
  }
コード例 #5
0
ファイル: swad_calendar.c プロジェクト: Amab/swad-core
void Cal_ChangeFirstDayOfWeek (void)
  {
   /***** Get param with icon set *****/
   Gbl.Prefs.FirstDayOfWeek = Cal_GetParamFirstDayOfWeek ();

   /***** Store icon first day of week database *****/
   if (Gbl.Usrs.Me.Logged)
      DB_QueryUPDATE ("can not update your setting about first day of week",
		      "UPDATE usr_data SET FirstDayOfWeek=%u"
		      " WHERE UsrCod=%ld",
                      Gbl.Prefs.FirstDayOfWeek,
                      Gbl.Usrs.Me.UsrDat.UsrCod);

   /***** Set settings from current IP *****/
   Set_SetSettingsFromIP ();
  }
コード例 #6
0
ファイル: swad_notice.c プロジェクト: proxymoron/swad-core
void Not_RevealHiddenNotice (void)
  {
   char Query[256];
   long NotCod;

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

   /***** Set notice as active *****/
   sprintf (Query,"UPDATE notices SET Status='%u'"
                  " WHERE NotCod='%ld' AND CrsCod='%ld'",
            (unsigned) Not_ACTIVE_NOTICE,
            NotCod,Gbl.CurrentCrs.Crs.CrsCod);
   DB_QueryUPDATE (Query,"can not reveal notice");

   /***** Update RSS of current course *****/
   RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
  }
コード例 #7
0
ファイル: swad_banner.c プロジェクト: Amab/swad-core
static void Ban_ShowOrHideBanner (bool Hide)
  {
   /***** 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);

   /***** Mark file as hidden/visible in database *****/
   if (Ban_EditingBan->Hidden != Hide)
      DB_QueryUPDATE ("can not change status of a banner in database",
		      "UPDATE banners SET Hidden='%c'"
		      " WHERE BanCod=%ld",
	              Hide ? 'Y' :
		             'N',
	              Ban_EditingBan->BanCod);
  }
コード例 #8
0
ファイル: swad_banner.c プロジェクト: Amab/swad-core
void Ban_ChangeBannerWWW (void)
  {
   extern const char *Txt_The_new_web_address_is_X;
   extern const char *Txt_You_can_not_leave_the_web_address_empty;
   char NewWWW[Cns_MAX_BYTES_WWW + 1];

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

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

   /* Get the new WWW for the banner */
   Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);

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

   /***** Check if new WWW is empty *****/
   if (NewWWW[0])
     {
      /* Update the table changing old WWW by new WWW */
      DB_QueryUPDATE ("can not update the web of a banner",
		      "UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
                      NewWWW,Ban_EditingBan->BanCod);

      /***** Write message to show the change made *****/
      Ale_CreateAlert (Ale_SUCCESS,NULL,
	               Txt_The_new_web_address_is_X,
                       NewWWW);
     }
   else
      Ale_CreateAlert (Ale_WARNING,NULL,
	               Txt_You_can_not_leave_the_web_address_empty);

   /***** Update web *****/
   Str_Copy (Ban_EditingBan->WWW,NewWWW,
             Cns_MAX_BYTES_WWW);
  }
コード例 #9
0
ファイル: swad_banner.c プロジェクト: Amab/swad-core
void Ban_ChangeBannerImg (void)
  {
   extern const char *Txt_The_new_image_is_X;
   extern const char *Txt_You_can_not_leave_the_image_empty;
   char NewImg[Ban_MAX_BYTES_IMAGE + 1];

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

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

   /* Get the new WWW for the banner */
   Par_GetParToText ("Img",NewImg,Ban_MAX_BYTES_IMAGE);

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

   /***** Check if new image is empty *****/
   if (NewImg[0])
     {
      /* Update the table changing old image by new image */
      DB_QueryUPDATE ("can not update the image of a banner",
		      "UPDATE banners SET Img='%s' WHERE BanCod=%ld",
                      NewImg,Ban_EditingBan->BanCod);

      /***** Write message to show the change made *****/
      Ale_CreateAlert (Ale_SUCCESS,NULL,
	               Txt_The_new_image_is_X,
                       NewImg);
     }
   else
      Ale_CreateAlert (Ale_WARNING,NULL,
	               Txt_You_can_not_leave_the_image_empty);

   /***** Update image *****/
   Str_Copy (Ban_EditingBan->Img,NewImg,
             Ban_MAX_BYTES_IMAGE);
  }