Where do we keep the website configuration file in yii? - yii

I want some information and settings are stored in the location Yii that I have access to it in anywhere of the program(controller,view,model .....)
Can i create this file as Component or Extension?
my another question:
How can I create a function that will auto run on all pages?(global function).

Depends on how the application is set up and there might be more of them.
Usually you can find it in protected/config/.
Link to how to use it http://www.yiiframework.com/wiki/59/.

Related

Programmatically set default column values based on folder in SharePoint Online

I'm working on enhancing metadata in our SharePoint online (O365) environment. Since a portion of my user base is used to foldering (explorer style), I've started using default column values to automatically set values on any files added to that specific folder (we have content organized categorically by folder currently). An example is our HR documents library - we have separate folders for recruiting, payroll, personnel files, etc. that automatically categorize files added to that folder with the same categories (recruiting, payroll, personnel, etc.). This supports both "search" and "click" users and makes adoption WAY easier while getting important metadata.
I want to implement this in a larger, more dynamic fashion, so manually setting default column values on each folder is not going to be scalable.
How can I reference the top level folder within the library (or even the current folder) for each newly added file and populate the "category" field for that new file with that folder name? I can do some very basic C# or Java code copy/paste, but bonus points for non-coding solutions =)
This problem can be solved through no coding.You can use the workflow to implement this by SharePoint Designer.
Create different view for different function team, and then use the view filter to show the document.
If you upload a file, use the workflow to set the metadata of the file. There are some known limitations: if you upload multiple files at the same time, the metadata for the file maybe does not work well; or if you upload a folder, the meta will not work for it and the file in the folder may not be set to right metadata.
I was actually able to use MS Flow to accomplish this in a pretty simple and straightforward fashion without managing custom views per team. The concept at a high level was:
(Trigger) When a new document is created in a folder in the library
Get the link of the parent folder of the newly added document
Create a variable (or just code it out in the Flow step) to parse out the name of the parent folder from the parent folder link (should be all text to the right of the last "/")
Set the category field as the variable
I'm sure that you could do the same right in a SharePoint designer workflow, but I prefer flow due to the visual aspect of it and being far easier to troubleshoot.

Export Application Settings to Shared Network Directory - Load / Import Settings on Startup

Can I export my application settings to a shared network drive and then 'point' users to it, essentially using this as a project settings 'ini' file.
I am referring to the system generated settings file created by the application. i.e. C:\APP_NAME\My Project\Settings.settings
For example I wish for all users on a particular project to use the same database connection string which is persisted in the application settings.
I would like the following functionality:
Administrator exports their application settings.
Users point to the exported settings file.
Settings file is used at startup for all users.
I have written a class to export a .txt file and transpose the settings at startup, but surely importing and exporting the settings file itself is a much more efficient and less error prone solution.
Thanks...
I think what you have done is correct. If you have written a method to read / import the settings at start, is this what you plan to achieve?
Couple of questions to go further into this...
What kind of settings are you actually trying to load? Are these startup dependent? or can they be loaded into the program at a later time? I.e. after the initial start / form has loaded?
Have you got access to SQL or MYSQL or similar? - If so you could write a small table with list of users or user groups and settings, then retrieve these using a hardcoded connection string (or another way you please), this can then be updated / modified by other 'Specified' users
It might even be nice to create a users table / csv to hold each user and then their permissions / group.
If you are not using SQL / MYSQL how are you making sure the text file cant be read, altered? Maybe look into some simple encryption (Its VERY easy, if this is needed at all?)

Adding a module in sugarCRM 6.5 C.E. doesn't create a corresponding folder in custom/modules

I need to add a logic hook to a module built in Module Builder in SugarCRM 6.5( Community Edition ).
This logic hook should take all the fields that I have just saved after completing a form in a module and create a new record in a different module with these fields( in order to simulate a workflow ).
All the tutorials on the internet( on logic hooks ) talk about modifying stuff in "./custom/Extension/modules//..." but, after creating and deploying a module in sugarCRM, I do NOT have my module present in either "./custom/Extension/modules/" or "./custom/modules" .
Thank you for your time,
Those directories are for customizations and extensions like studio changes and custom code like hooks.
That those directories are not present only means that there are no customizations yet, so feel free to create those folders and add your hook inside.
Make sure that you create the directories with the correct names (as stated in the tutorials), including the correct case for all letters.
Also don't forget to give the web-process ownership/write-permissions to the all folders you create in custom, otherwise Sugar might fail to save studio changes and aggregation files at some point in the future.

Xpages : Possible to inherit all Select 2 components

I have got Select2 working. Awesome, awesome component.
We have a db with some common elements which we inherit to databases. I would like to add Select2 to this db, so it will be easily available to databases, but don't know how to do that, as you have to put some items in the package explorer.
Any way to do this?
It is possible if you inherit the whole template:
create a database with all design elements you want to have as default in a database including Select2 parts in WebContent folder
define this database as template "CommonElements" (or another unique template name) in database properties
define the template "CommonElements" as "Inherit design from master template" in every database where those design elements are needed
and make sure that every additional design element has set "Prohibit design refresh"
or inherits from a design template.
In case you have additional elements in WebContent folder set "Prohibit design refresh" flag to those design elements with File > Application > Set Prohibit Refresh Properity... too
All design elements including all WebContent folders are inherited from master template when you execute File > Application > Refresh Design... or when designer process runs on server.
I don't think that is possible. You could set up a central "resources.nsf" with the select2 components and load all the resources you need (manually) from all other databases.
Unless your users do not have internet access (either fire-walled or offline) you may as well just use a CDN. That way all your users will have a cached version of the download library on all of your sites and you don't have to worry about hosting it somehow.
https://cdnjs.com/libraries/select2
for example
It might also be worth looking at the Import and Export from Domino Designer project on OpenNTF. It allows you to create an portlist.xml file, which tells the plugin which files to import. It still requires a manual action to import, but will allow you to overwrite files.
Although using plugins is the place to aim to get to, this is a perfectly valid and good practice method for handling copying all relevant files into an NSF. It's used in XPages OpenLog Logger project on OpenNTF, for the NSF-based option.

Cocoa Lumberjack how to write in same folder with different file name

With help of this CocoaLumberjack FileLogger logging to multiple files , I am able to create multiple log files (with same name in multiple directories),
But I need to use DDLog in one of my project where it is required to write multiple logs files in the same directory with different names.
Is there any way to attain this?
DDFileLogger uses logFileManager for managing logfiles. By default it uses DDLogFileManagerDefault. You can create your own file manager that confirms to DDLogFileManager protocol and provide whatever behavior you need.
The easiest way doing this is to copy DDLogFileManagerDefault and change it to feet your needs.