-
Who's Online 3 Members, 0 Anonymous, 335 Guests (See full list)
All Activity
- Today
-
Thanks all. Mask - yes I know about that. Just an SVG that is applied to the image overlay, with some CSS that controls the sizing. If both are moving, it's prob a little tricky to recreate. Just kind of wondering generally how to do it. I know CSS pretty well, really well, but this is as someone here said, almost double layered CSS animation.
-
You need to get really familiar with the web development tools, inspect elements look at page source code, and figure out how to figure out these things for yourself. When you say "comes in like that, there are multiple things happening, but in general, these are all css animations. Do some learning in regards to how they work, and things like keyframes. This is an elementor hosted site, and thus it includes a bunch of styles that come in from the elementor.min.css file, that is part of their publishing platform. So if you look at the image in the top right, and the flex box it is contained within, you will notice a lot of different styles driving this functionality. I will hi-light a couple for you: <div class="elementor-container elementor-column-gap-no"> <div class="elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-af52a3e animated-slow alpha-entrance-reveal animated rotateInDownRight" data-id="af52a3e" data-element_type="column" data-settings="{"animation":"rotateInDownRight"}"> <div class="elementor-widget-wrap elementor-element-populated"> <div class="elementor-element elementor-element-bca11ec animated-slow elementor-widget elementor-widget-image animated fadeInRightShorter" data-id="bca11ec" data-element_type="widget" data-settings="{"_animation":"fadeInRightShorter"}" data-widget_type="image.default"> <img fetchpriority="high" decoding="async" width="945" height="763" src="https://d-themes.com/wordpress/udesign/corporate-4/wp-content/uploads/sites/74/2024/10/intro-banner-image.png" class="lazy-fade attachment-full size-full wp-image-3916" alt="Banner" srcset="https://d-themes.com/wordpress/udesign/corporate-4/wp-content/uploads/sites/74/2024/10/intro-banner-image.png 945w, https://d-themes.com/wordpress/udesign/corporate-4/wp-content/uploads/sites/74/2024/10/intro-banner-image-768x620.png 768w" sizes="(max-width: 945px) 100vw, 945px"> </div> <div class="elementor-element elementor-element-e4a20a1 elementor-widget__width-auto elementor-absolute animated-slow elementor-widget elementor-widget-image animated fadeIn" data-id="e4a20a1" data-element_type="widget" data-settings="{"_position":"absolute","_animation":"fadeIn","_animation_delay":600}" data-widget_type="image.default"> <img decoding="async" width="279" height="623" src="https://d-themes.com/wordpress/udesign/corporate-4/wp-content/uploads/sites/74/2023/08/shape-1.png" class="lazy-fade attachment-large size-large wp-image-727" alt="shape"> </div> </div> </div> </div> Notice that this div that contains these other divs, has some styles like: alpha-entrance-reveal, animated, rotateInDownRight, etc. Figure out where these styles are defined. You can do this by clicking on the style names in dev tools. You will find that for "rotateInDownRight" there's this definition: .alpha-entrance-reveal.rotateInDownRight { animation-name: revealRotateInDownRight; } The dev tools even include a little paperclip icon that that will run the animation when clicked, so you can easily see the effect it produces. Look up the css definition of animation-name and what it does. CSS Animations like many similar packages utilize key frames. You set up a particular state and the animation calculates how to get from that initial state to future keyframes. So the definition of "revealRotateInDownRight" turns out to be this css animation: @keyframes revealRotateInDownRight { 0% { transform: rotate(25deg); transform-origin: right bottom } to { transform: rotate(0); transform-origin: right bottom } } It should be apparent that what is happening is that it is starting with the element rotated 25 degrees, using the bottom right corner as the "origin". You want to investigate what an "origin" is for in a grid or animation system. When the animation is complete, the element will no longer be rotated. What you can do, is make small tests to explore these effects. It should go without saying that there are many other styles that are contributing to the overall animation effects of the page, but individually you can understand them once you break them down and isolate them. If you investigate the "fadeInRightShorter" you will find a similar transformation that utilizes transform-origin. @keyframes fadeInRightShorter { 0% { opacity: 0; transform: translate(50px,0); transform-origin: 0 0 } to { opacity: 1; transform: none } } .fadeInRightShorter { animation-name: fadeInRightShorter } This page has an awful lot going on, including the use of Skrollr, which is a really old javascript scroll animation library.
- Yesterday
-
I don't know the exact code, but I can tell you they not only were moving the image they were also using a mask at the same time giving the illusion that it move farther than it did. Moving the image a little bit should be easy enough it's the masking part that rotates that might be a little tricky.
-
liamsammy joined the community
-
https://d-themes.com/wordpress/udesign/corporate-4/ Hi We are trying to create this effect on a website. So when the image loads, it comes in like that. I've tried to delve into the code, but can't quite work out what's needed. Does anyone know the solution so we can look and test?
-
nightcoderuk joined the community
- Last week
-
Feelex joined the community
-
Perhaps a GROUP BY issue going from MySQL 7.# to 8.#...
Jim R replied to Jim R's topic in MySQL Help
Yeah, I found it. Not sure what I did to delete it. -
Perhaps a GROUP BY issue going from MySQL 7.# to 8.#...
requinix replied to Jim R's topic in MySQL Help
It worked for years even though it's clearly missing a comma at the end of the first line? -
For four years the query below worked for a Function I wrote. Players being recruited for college basketball. They get scholarship offers from colleges. Some of them get so many, toward the end they reduce it to a smaller list. Then they commit. This Function is then used/referred to in several places on the site. As MySQL upgraded to 8.#, it broke. I'm getting a Syntax error at line 3, which is the first GROUP_CONCAT. $query = "SELECT *,p.id as pid,po.playerID as offerID,recruit_type GROUP_CONCAT( CASE WHEN recruit_type = 'Offer' THEN c.college END) as offers, GROUP_CONCAT( CASE WHEN recruit_type = 'List' THEN c.college END) as list, CASE WHEN other !='' THEN concat(c.college,' (',other,')') WHEN recruit_type = 'Commit' THEN c.college END as commit FROM a_players p LEFT JOIN a_schools s ON p.schoolID = s.id LEFT JOIN a_players_offers po ON po.playerID = p.id LEFT JOIN a_colleges c ON po.collegeID = c.id WHERE p.id = '". $pid ."'";
-
php segmentation fault when connecting to Access database
jodunno replied to raphael75's topic in PHP Coding Help
I'm just wondering if you have both odbc extensions installed? since you only show the pdo_odbc extension. I thought that both extensions are required. I do not use Linux or ODBC but i have both extensions installed in FreeBSD. $ pkg search -x ^.*\-odbc.*\- php83-odbc-8.3.19_1 php84-odbc-8.4.5_1 $ pkg search -x ^.*\-pdo_odbc.*\- php83-pdo_odbc-8.3.19_1 php84-pdo_odbc-8.4.5_1 /usr/local/etc/php/ext-20-odbc.ini /usr/local/etc/php/ext-30-pdo_odbc.ini certainly there could be an issue with the extension but it will be nice to know if you have both extensions installed and enabled. -
This is often the case with devops tools. Unless there is a company or core contributor behind it who wants to write one, there probably isn't going to be a book. Being written in Python, the better you understand Python, the more you'll understand Ansible basics, particularly in terms of the data types. You also want to feel pretty comfortable with Yaml, given your playbooks are yaml files. It's not my favorite way to try and learn a tool, but this is a really complete and well done video that covers Yaml (and probably some things that it allows for but you rarely see used) -> I will also say that for tools like this, I find you really want to have some ongoing problems you are trying to solve, because books or courses aren't guaranteed to match up with your particular needs. What I did at the time (and I didn't know Python at all at that point) was to go through this Udemy class: https://www.udemy.com/course/diveintoansible/ Just to be clear, I only buy Udemy courses during the times when they have their sales, and courses are $20 or less. That course was very good. The instructor provides a Docker based lab environment you work with, so you can follow along, experiment etc. As I was already using Docker quite a bit, that was easy for me to work with, and at the time struck me as a great way to tackle things. I also had a long history of unix system administration experience under my belt, and all of those fundamentals (things like ssh keys, and security, and how you set up servers etc), not to mention years of working with AWS, allowed me to absorb the material, discern how to start working with Ansible, and get things built with it. Even with all that being true, there were still many things that I had to figure out how to do on my own, but the course was really the dividing point for me of knowing Ansible existed (I'd used Puppet and a little bit of Chef previously) and believing it could be the basis of some automation tools I wanted to create, and actually writing/testing and using those playbooks. Just for the heck of it, here's one very simple playbook I wrote one day, that uses the yum package manager (used with redhat based distros) to update a group of servers. This is so generic I can share it. Obviously, most of it just comes from knowing I wanted to update server packages using yum, and googling "ansible yum module" seeing there was an existing module, and just scanning that. There's the boilerplate yaml file and comments I got from the course (which I have as a starter file I use when writing one), and you can see just the one task. --- # YAML documents begin with the document separator --- # The minus in YAML this indicates a list item. The playbook contains a list # of plays, with each play being a dictionary - # Hosts: where our play will run and options it will run with hosts: prod # Tasks: the list of tasks that will be executed within the playbook tasks: - name: Update installed packages become: yes become_method: sudo yum: name: '*' state: latest become_user: root # Three dots indicate the end of a YAML document ... So to conclude: the fundamentals of Yaml and Ansible are fairly simple. The power is in the modules, and you are going to read the module documentation at the point you already know that there's a particular tool you would otherwise be using to solve a problem.
-
Based on your statements, the only thing I can think of, is that the new server might be restricting PHP from making socket connections of any type. Given that you are running this, I gather as page triggered within the web server (php running via the web server) then it might be something in the php.ini setting that is different and more restrictive. I would go through the php.ini for the new server in detail, starting with a basic phpinfo().
-
php segmentation fault when connecting to Access database
requinix replied to raphael75's topic in PHP Coding Help
Did you run gdb the same way as you had before? Did you get the same output (before the bt step) as before, including the part where it says there was a segmentation fault? -
php segmentation fault when connecting to Access database
raphael75 replied to raphael75's topic in PHP Coding Help
@requinix I was just wondering if you might know why when I run the gdb now and then "bt" it now says "No stack."? I tried it with multiple queries and in each case "bt" just shows "No stack.". - Earlier
-
Naturalwellness joined the community
-
vyv joined the community
-
I have a form allowing the user to enter students' attendance. The scenario is that the user selects the Academic Year, ASC center, and Date. The user selects the students, then selects their corresponding standard, and selects the attendance status as shown in the image below. I have applied a custom validation to the Standard field, where the validation errors should be displayed immediately if the validation logic fails. Everything works correctly as expected, but the validation errors are displayed only after the form is submitted and not immediately. Below is the action create public function actionCreate() { $model = new Attendancereport(); $modelsStudentattendance = [new Attendancereportdetails]; if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post())) { $identity = Yii::$app->user->identity->getonlyid(); $model->UserId = $identity; $modelsStudentattendance = Model::createMultiple(Attendancereportdetails::classname()); Model::loadMultiple($modelsStudentattendance, Yii::$app->request->post()); $valid = $model->validate(); $valid = Model::validateMultiple($modelsStudentattendance) && $valid; if($valid) { $transaction = \Yii::$app->db->beginTransaction(); try { if ($flag = $model->save()) { foreach ($modelsStudentattendance as $modelsStudentattendance) { $modelsStudentattendance->AttendanceReportId = $model->AttendanceReportId; if (! ($flag = $modelsStudentattendance->save())) { $transaction->rollBack(); break; } } } if ($flag) { $transaction->commit(); return $this->redirect(['view', 'id' => $model->AttendanceReportId]); } } catch (Exception $e) { $transaction->rollBack(); } } } return $this->render('create', [ 'model' => $model, 'modelsStudentattendance' => (empty($modelsStudentattendance)) ? [new Attendancereportdetails] : $modelsStudentattendance, ]); } Below is the form <?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\jui\DatePicker; use wbraganca\dynamicform\DynamicFormWidget; use app\models\Ascassignment; use app\models\Asccenter; use app\models\Academicyear; use kartik\time\TimePicker; use yii\helpers\ArrayHelper; use app\models\Student; ?> <script> $(document).ready(function() { $(".i").each(function(k,v){ $(".i").attr("disabled","true"); }); }); $(document).ready(function(){ //When the user clicks on the plus button $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { const $i = $(item).find('.i'); //Populates all the student drop-down with the student names belonging to the ASC center $.post("index.php?r=student/student-lists&id="+$("select#attendancereport-ascid").val(),function(data){ $i.html(data); }); }); $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { //const $s = $(item).find('.s'); var e = $(this); //Populates the Standard drop-down for selected student $.post("index.php?r=attendancereport/standard&aid="+$("select#attendancereport-academicyearid").val()+"&ascid="+$("select#attendancereport-ascid").val()+"&sid="+e.val(),function(data){ e.closest("tr").find(".s").html(data); }); }); }); </script> <div class="attendancereport-form"> <?php $form = ActiveForm::begin([ 'id' => 'dynamic-form', 'enableAjaxValidation' => true, 'enableClientValidation' => true, 'validateOnChange' => true, 'validateOnBlur' => true, 'options' => ['class' => 'disable-submit-buttons'], ]);?> <div class="panel panel-primary " > <div class="panel panel-heading"><font size="3"><b>Student Attendance Report</b></font></div> <div class="row"> <div class="col-sm-4"> <?= $form->field($model, 'AcademicYearId')->dropDownList(ArrayHelper::map(Academicyear::find()->where(['DisplayStatus'=>'Enabled'])->all(),'Id','academicyear'), ['prompt' => 'Select Academic Year','onChange'=>' var e = $(this); $.post("index.php?r=attendancereport/standard&aid=' . '"+$("select#attendancereport-academicyearid").val()+"&ascid=' . '"+$("select#attendancereport-ascid").val()+"&sid=' . '"+e.val(),function(data){ e.closest("tr").find(".s").html(data); }); '])?> </div> <div class="col-sm-4"> <?= $form->field($model, 'ASCId')->dropDownList(ArrayHelper::map(Asccenter::find()->leftJoin('ascassignment','`ascassignment`.`ASCId`=`asccenter`.`ASCId`')->where(['ascassignment.UserId' => \Yii::$app->user->identity->getonlyid()])->all(),'ASCId','ASCName'), ['prompt' => 'Select ASC Center','class'=>'form-control ascid','onChange' => ' $.post("index.php?r=student/student-lists&id=' . '"+$("select#attendancereport-ascid").val(),function(data){ $(".i").each(function(k,v) { $(".i").attr("disabled",false); $(".i").html(data); } ); }); var e = $(this); $.post("index.php?r=attendancereport/standard&aid=' . '"+$("select#attendancereport-academicyearid").val()+"&ascid=' . '"+$("select#attendancereport-ascid").val()+"&sid=' . '"+e.val(),function(data){ $(".s option:not(:first-child)").remove(); e.closest("tr").find(".s").html(data); }); ' ]) ?> </div> <div class="col-sm-4"> <?= $form->field($model, 'DateofReport')->widget(DatePicker::classname(), [ //'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control picker','readOnly'=>'readOnly'], 'clientOptions'=>['changeMonth'=>false, 'changeYear'=>false, 'maxDate'=>'today', 'stepMonths'=> false, ], ]) ?> </div> </div> </div> <div class="panel panel-primary"> <div class="panel-heading"><font size="3"><b>Student Attendance Details</b></font></div> <?php DynamicFormWidget::begin([ 'widgetContainer' => 'dynamicform_studentattendance', 'widgetBody' => '.container-studentattendance', 'widgetItem' => '.studentattendance-item', 'limit' =>500, 'min' => 1, 'insertButton' => '.add-studentattendance', 'deleteButton' => '.remove-studentattendance', 'model' => $modelsStudentattendance[0], 'formId' => 'dynamic-form', 'formFields' => [ 'StudentId', 'Standard', 'AttendanceStatus', ], ]); ?> <table class="table table-bordered"> <thead> <tr bgcolor='#B8B8B8'> <th style='border: 1px solid black;'></th> <th class ="text-center" style='border: 1px solid black;'>Student</th> <th class ="text-center" style='border: 1px solid black;'>Standard</th> <th class ="text-center" style='border: 1px solid black;'>Attendance Status</th> <th class="text-center" style='border: 1px solid black;'>Action</th> </tr> </thead> <tbody class="container-studentattendance"> <?php foreach ($modelsStudentattendance as $indexStudent => $modelStudentattendance): ?> <tr class="studentattendance-item"> <td class="vcenter" style='border: 1px solid black;'> <?php // necessary for update action. if (! $modelStudentattendance->isNewRecord) { echo Html::activeHiddenInput($modelStudentattendance, "[{$indexStudent}]AttendanceReportDetailsId"); } ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]StudentId")->label(false)->dropDownList(ArrayHelper::map(Student::find()->all(),'StudentId','StudentName'), ['prompt' => 'Select Student','class'=>'form-control i','onChange'=>' var e = $(this); $.post("index.php?r=attendancereport/standard&aid=' . '"+$("select#attendancereport-academicyearid").val()+"&ascid=' . '"+$("select#attendancereport-ascid").val()+"&sid=' . '"+e.val(),function(data){ e.closest("tr").find(".s").html(data); }); ']) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]Standard")->label(false)->dropDownList([], [ 'prompt' => 'Select Standard', 'class' => 'form-control s', ]) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]AttendanceStatus")->label(false)->dropDownList(['Present'=>'Present', 'Absent' => 'Absent'], ['prompt'=>'Select Attendance Status'])?> </td> <td class="text-center vcenter" style='border: 1px solid black;'> <button type="button" class="add-studentattendance btn btn-success btn-xs"><span class="fa fa-plus"></span></button> <button type="button" class="remove-studentattendance btn btn-danger btn-xs"><span class="fa fa-minus"></span></button> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php DynamicFormWidget::end(); ?> </div> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::resetButton('Reset',['class' => 'btn btn-default'])?> </div> <?php ActiveForm::end(); ?> </div>
-
I've posted an issue on the github site, but the developer hasn't addressed the issue (as of yet). Undefined constant "LOG_READ_SIZE" #28
-
Am I missing anything? I Can't find anything besides docs.
-
So, after giving up on the documentation I gave postman.com a gander. All the parameters are supposed to be sent within the URL, and the file as the only information in the post field. They also allow you to send plain text, and they will encode it for you. So here is what I did: $uploadPath = str_replace("/".basename($args['uploadPath']), '', $args['uploadPath']); $accessToken = getPcloudToken(); $query = array('filename'=>'file.csv', 'nopartial'=>'1', 'path'=> $uploadPath); $product_data = $args['product_data']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.pcloud.com/uploadfile?'.http_build_query($query)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $product_data); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Authorization: Bearer '.$accessToken)); curl_exec($ch); curl_close($ch); I was able to take the whole temp file creation out. so that was nice
-
i don't know what this will look like incorporated into the yii syntax, but this is what i used with just jquery/javascript - // the element that was clicked on var e = $(this); $.post("index.php?r=attendancereport/standard&aid="+$("#academicyearid").val()+ "&ascid="+$("#ascid").val()+"&sid="+e.val(),function(data){ e.closest('tr').find('.s').html(data); });
-
that's because the current code is looping over the collection of class = s elements, and setting them all to the data that is returned - $(".s").each(function(k,v) { $(".s").html(data); //Populates the Standard drop-down having class .s with the data from the Standard function } ); you need to 'find' the correct class = s element and set it to the data that is returned. take a look at the jquery .parent() method to find a common parent container that all the related form fields are in, then use the jquery .find() method to find the element with class = s.
-
I modified the code as you said, but now what is happening is that when the user selects the first student, then his Standard 3rd gets populated in the corresponding Standard drop-down, but when the user clicks on the plus button and selects the second student, then her Standard 4th gets populated in the first student Standard drop-down as well. Modified code <?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\jui\DatePicker; use wbraganca\dynamicform\DynamicFormWidget; use app\models\Ascassignment; use app\models\Asccenter; use app\models\Academicyear; use kartik\time\TimePicker; use yii\helpers\ArrayHelper; use app\models\Student; ?> <script> $(document).ready(function() { $(".i").each(function(k,v){ $(".i").attr("disabled","true"); }); }); $(document).ready(function(){ //When the user clicks on plus button $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { const $i = $(item).find('.i'); //Populates student names belonging to the selected ASC center $.post("index.php?r=student/student-lists&id="+$("select#attendancereport-ascid").val(),function(data){ $i.html(data); }); }); $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { const $s = $(item).find('.s'); //Populates standard for the selected student $.post("index.php?r=attendancereport/standard&aid="+$("select#attendancereport-academicyearid").val()+"&ascid="+$("select#attendancereport-ascid").val()+"&sid="+$(this).val(),function(data){ $s.html(data); }); }); }); </script> <div class="attendancereport-form"> <?php $form = ActiveForm::begin(['id' => 'dynamic-form', 'options' => ['class' => 'disable-submit-buttons'], ]);?> <div class="panel panel-primary " > <div class="panel panel-heading"><font size="3"><b>Student Attendance Report</b></font></div> <div class="row"> <div class="col-sm-4"> <?= $form->field($model, 'AcademicYearId')->dropDownList(ArrayHelper::map(Academicyear::find()->where(['DisplayStatus'=>'Enabled'])->all(),'Id','academicyear'), ['prompt' => 'Select Academic Year'])?> </div> <div class="col-sm-4"> <?= $form->field($model, 'ASCId')->dropDownList(ArrayHelper::map(Asccenter::find()->leftJoin('ascassignment','`ascassignment`.`ASCId`=`asccenter`.`ASCId`')->where(['ascassignment.UserId' => \Yii::$app->user->identity->getonlyid()])->all(),'ASCId','ASCName'), ['prompt' => 'Select ASC Center','class'=>'form-control ascid','onChange' => ' $.post("index.php?r=student/student-lists&id=' . '"+$(this).val(),function(data){ $(".i").each(function(k,v) { $(".i").attr("disabled",false); $(".i").html(data); // Populates the Student control having class .i with the data from the StudentList function } ); }); ' ]) ?> </div> <div class="col-sm-4"> <?= $form->field($model, 'DateofReport')->widget(DatePicker::classname(), [ //'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control picker','readOnly'=>'readOnly'], 'clientOptions'=>['changeMonth'=>false, 'changeYear'=>false, 'maxDate'=>'today', 'stepMonths'=> false, ], ]) ?> </div> </div> </div> <div class="panel panel-primary"> <div class="panel-heading"><font size="3"><b>Student Attendance Details</b></font></div> <?php DynamicFormWidget::begin([ 'widgetContainer' => 'dynamicform_studentattendance', 'widgetBody' => '.container-studentattendance', 'widgetItem' => '.studentattendance-item', 'limit' =>500, 'min' => 1, 'insertButton' => '.add-studentattendance', 'deleteButton' => '.remove-studentattendance', 'model' => $modelsStudentattendance[0], 'formId' => 'dynamic-form', 'formFields' => [ 'StudentId', 'Standard', 'AttendanceStatus', ], ]); ?> <table class="table table-bordered"> <thead> <tr bgcolor='#B8B8B8'> <th style='border: 1px solid black;'></th> <th class ="text-center" style='border: 1px solid black;'>Student</th> <th class ="text-center" style='border: 1px solid black;'>Standard</th> <th class ="text-center" style='border: 1px solid black;'>Attendance Status</th> <th class="text-center" style='border: 1px solid black;'>Action</th> </tr> </thead> <tbody class="container-studentattendance"> <?php foreach ($modelsStudentattendance as $indexStudent => $modelStudentattendance): ?> <tr class="studentattendance-item"> <td class="vcenter" style='border: 1px solid black;'> <?php // necessary for update action. if (! $modelStudentattendance->isNewRecord) { echo Html::activeHiddenInput($modelStudentattendance, "[{$indexStudent}]AttendanceReportDetailsId"); } ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]StudentId")->label(false)->dropDownList(ArrayHelper::map(Student::find()->all(),'StudentId','StudentName'), ['prompt' => 'Select Student','class'=>'form-control i','onChange'=>' $.post("index.php?r=attendancereport/standard&aid=' . '"+$("select#attendancereport-academicyearid").val()+"&ascid=' . '"+$("select#attendancereport-ascid").val()+"&sid=' . '"+$(this).val(),function(data){ $(".s").html(data); //Populates the Standard drop-down having class .s with the data from the Standard function }); ']) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]Standard")->label(false)->dropDownList([], ['prompt'=>'Select Standard','class'=>'form-control s']) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]AttendanceStatus")->label(false)->dropDownList(['Present'=>'Present', 'Absent' => 'Absent'], ['prompt'=>'Select Attendance Status'])?> </td> <td class="text-center vcenter" style='border: 1px solid black;'> <button type="button" class="add-studentattendance btn btn-success btn-xs"><span class="fa fa-plus"></span></button> <button type="button" class="remove-studentattendance btn btn-danger btn-xs"><span class="fa fa-minus"></span></button> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php DynamicFormWidget::end(); ?> </div> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::resetButton('Reset',['class' => 'btn btn-default'])?> </div> <?php ActiveForm::end(); ?> </div>
-
the most immediate problem is that the onChange code for the Student select/option menu needs to get the correct sid value. by using $(".i") you are getting a collection of all the class = i elements, not the current one. using $(this) should work (all suggestions are untested unless indicated otherwise.) next, requiring the user to select each student from a select/option menu is a poor User Interface (UI) and provides a bad User eXperience (UX). you should simply list out each Student, the Standard select/option menu with any existing choice pre-selected, and the Attendance select/option menu with the Present choice pre-selected (the most common case.) the user should only need to make the fewest number of changes to the choices and submit the form, so, only make any Standard changes and select which students are Absent.
-
I have a form allowing the user to enter students' attendance as shown in the image. The scenario is that the user selects the ASC center. Upon choosing the ASC center, students belonging to that ASC center get populated in the Student drop-down. When the user selects Student, the student's standard should be displayed. I have a function called Standard that checks if the student's attendance record exists for the given academic year, ASC center, and student. If a record exists, then the standard of the student gets returned as shown below public function actionStandard($aid,$ascid,$sid) { $count = \Yii::$app->db->createCommand("SELECT COUNT(*) from attendancereportdetails,attendancereport where attendancereportdetails.AttendanceReportId=attendancereport.AttendanceReportId and attendancereport.AcademicYearId=:ayear and attendancereport.ASCId=:acenter and attendancereportdetails.StudentId=:student and attendancereportdetails.Standard!=''")->bindValues([':ayear'=>$aid,':acenter'=>$ascid,':student'=>$sid])->queryAll(); $count_result; foreach($count as $count_records) { $count_result = $count_records['COUNT(*)']; } $records = \Yii::$app->db->createCommand("SELECT * from attendancereportdetails,attendancereport where attendancereportdetails.AttendanceReportId=attendancereport.AttendanceReportId and attendancereport.AcademicYearId=:ayear and attendancereport.ASCId=:acenter and attendancereportdetails.StudentId=:student and attendancereportdetails.Standard!=''")->bindValues([':ayear'=>$aid,':acenter'=>$ascid,':student'=>$sid])->queryAll(); if ($count_result > 0) { echo "<option value>Select Standard</option>"; foreach ($records as $record) { ob_start(); if($record['Standard']==0) echo "<option value=" . $record['Standard'] . ">" . 'Nursery' . "</option>"; if($record['Standard']==1) echo "<option value=" . $record['Standard'] . ">" . '1st'. "</option>"; if($record['Standard']==2) echo "<option value=" . $record['Standard'] . ">" . '2nd'. "</option>"; if($record['Standard']==3) echo "<option value=" . $record['Standard'] . ">" . '3rd'. "</option>"; if($record['Standard']==4) echo "<option value=" . $record['Standard'] . ">" . '4th'. "</option>"; if($record['Standard']==5) echo "<option value=" . $record['Standard'] . ">" . '5th'. "</option>"; if($record['Standard']==6) echo "<option value=" . $record['Standard'] . ">" . '6th'. "</option>"; if($record['Standard']==7) echo "<option value=" . $record['Standard'] . ">" . '7th'. "</option>"; if($record['Standard']==8) echo "<option value=" . $record['Standard'] . ">" . '8th'. "</option>"; if($record['Standard']==9) echo "<option value=" . $record['Standard'] . ">" . '9th'. "</option>"; if($record['Standard']==10) echo "<option value=" . $record['Standard'] . ">" . '10th'. "</option>"; } } else { echo "<option value=''selected disabled>Select Standard</option>"; echo "<option value=0>Nursery</option>"; echo "<option value=1>1st</option>"; echo "<option value=2>2nd</option>"; echo "<option value=3>3rd</option>"; echo "<option value=4>4th</option>"; echo "<option value=5>5th</option>"; echo "<option value=6>6th</option>"; echo "<option value=7>7th</option>"; echo "<option value=8>8th</option>"; echo "<option value=9>9th</option>"; echo "<option value=10>10th</option>"; } } Below is the image of the form. The problem occurring here is that the first student selected, his standard, is only getting populated in all other students' standards, as shown below. The requirement is that for each different student, their standard should only get populated in their corresponding Standard drop-down. Below is the form <?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\jui\DatePicker; use wbraganca\dynamicform\DynamicFormWidget; use app\models\Ascassignment; use app\models\Asccenter; use app\models\Academicyear; use kartik\time\TimePicker; use yii\helpers\ArrayHelper; use app\models\Student; ?> <script> $(document).ready(function() { $(".i").each(function(k,v){ $(".i").attr("disabled","true"); }); }); $(document).ready(function(){ //When the user clicks on plus button $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { const $i = $(item).find('.i'); //Populates student names belonging to the selected ASC center $.post("index.php?r=student/student-lists&id="+$("select#attendancereport-ascid").val(),function(data){ $i.html(data); }); }); $(".dynamicform_studentattendance").on("afterInsert", function(e, item) { const $s = $(item).find('.s'); //Populates standard for the selected student $.post("index.php?r=attendancereport/standard&aid="+$("select#attendancereport-academicyearid").val()+"&ascid="+$("select#attendancereport-ascid").val()+"&sid="+$(".s").val(),function(data){ $s.html(data); }); }); }); </script> <div class="attendancereport-form"> <?php $form = ActiveForm::begin(['id' => 'dynamic-form', 'options' => ['class' => 'disable-submit-buttons'], ]);?> <div class="panel panel-primary " > <div class="panel panel-heading"><font size="3"><b>Student Attendance Report</b></font></div> <div class="row"> <div class="col-sm-4"> <?= $form->field($model, 'AcademicYearId')->dropDownList(ArrayHelper::map(Academicyear::find()->where(['DisplayStatus'=>'Enabled'])->all(),'Id','academicyear'), ['prompt' => 'Select Academic Year'])?> </div> <div class="col-sm-4"> <?= $form->field($model, 'ASCId')->dropDownList(ArrayHelper::map(Asccenter::find()->leftJoin('ascassignment','`ascassignment`.`ASCId`=`asccenter`.`ASCId`')->where(['ascassignment.UserId' => \Yii::$app->user->identity->getonlyid()])->all(),'ASCId','ASCName'), ['prompt' => 'Select ASC Center','class'=>'form-control ascid','onChange' => ' $.post("index.php?r=student/student-lists&id=' . '"+$(this).val(),function(data){ $(".i").each(function(k,v) { $(".i").attr("disabled",false); $(".i").html(data); // Populates the Student control having class .i with the data from the StudentList function } ); }); ' ]) ?> </div> <div class="col-sm-4"> <?= $form->field($model, 'DateofReport')->widget(DatePicker::classname(), [ //'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control picker','readOnly'=>'readOnly'], 'clientOptions'=>['changeMonth'=>false, 'changeYear'=>false, 'maxDate'=>'today', 'stepMonths'=> false, ], ]) ?> </div> </div> </div> <div class="panel panel-primary"> <div class="panel-heading"><font size="3"><b>Student Attendance Details</b></font></div> <?php DynamicFormWidget::begin([ 'widgetContainer' => 'dynamicform_studentattendance', 'widgetBody' => '.container-studentattendance', 'widgetItem' => '.studentattendance-item', 'limit' =>500, 'min' => 1, 'insertButton' => '.add-studentattendance', 'deleteButton' => '.remove-studentattendance', 'model' => $modelsStudentattendance[0], 'formId' => 'dynamic-form', 'formFields' => [ 'StudentId', 'Standard', 'AttendanceStatus', ], ]); ?> <table class="table table-bordered"> <thead> <tr bgcolor='#B8B8B8'> <th style='border: 1px solid black;'></th> <th class ="text-center" style='border: 1px solid black;'>Student</th> <th class ="text-center" style='border: 1px solid black;'>Standard</th> <th class ="text-center" style='border: 1px solid black;'>Attendance Status</th> <th class="text-center" style='border: 1px solid black;'>Action</th> </tr> </thead> <tbody class="container-studentattendance"> <?php foreach ($modelsStudentattendance as $indexStudent => $modelStudentattendance): ?> <tr class="studentattendance-item"> <td class="vcenter" style='border: 1px solid black;'> <?php // necessary for update action. if (! $modelStudentattendance->isNewRecord) { echo Html::activeHiddenInput($modelStudentattendance, "[{$indexStudent}]AttendanceReportDetailsId"); } ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]StudentId")->label(false)->dropDownList(ArrayHelper::map(Student::find()->all(),'StudentId','StudentName'), ['prompt' => 'Select Student','class'=>'form-control i','onChange'=>' $.post("index.php?r=attendancereport/standard&aid=' . '"+$("select#attendancereport-academicyearid").val()+"&ascid=' . '"+$("select#attendancereport-ascid").val()+"&sid=' . '"+$(".i").val(),function(data){ $(".s").each(function(k,v) { $(".s").html(data); //Populates the Standard drop-down having class .s with the data from the Standard function } ); }); ']) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]Standard")->label(false)->dropDownList([], ['prompt'=>'Select Standard','class'=>'form-control s']) ?> </td> <td style='border: 1px solid black;'> <?= $form->field($modelStudentattendance, "[{$indexStudent}]AttendanceStatus")->label(false)->dropDownList(['Present'=>'Present', 'Absent' => 'Absent'], ['prompt'=>'Select Attendance Status'])?> </td> <td class="text-center vcenter" style='border: 1px solid black;'> <button type="button" class="add-studentattendance btn btn-success btn-xs"><span class="fa fa-plus"></span></button> <button type="button" class="remove-studentattendance btn btn-danger btn-xs"><span class="fa fa-minus"></span></button> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php DynamicFormWidget::end(); ?> </div> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::resetButton('Reset',['class' => 'btn btn-default'])?> </div> <?php ActiveForm::end(); ?> </div>
-
Can anyone make heads or tales of this? I am playing around with pCloud. The Pcloud file upload documentation is kinda vague. they don't explain where or how to attach the file, just how to name it, and where to put it. They even have instructions on how to send it as binaries. but that is also kind of vague. Can someone see what I am missing? This code is supposed to take a string, create a temp file, and then upload it. at the moment, it uploads a file with the right file name, but only contains two dashes $uploadPath = 'uploadpath'; $accessToken = AccessToken; $product_data = fopen('php://memory', 'r+'); fputs($product_data, 'content string'); rewind($product_data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.pcloud.com/uploadfile' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, array('filename'=>'test.csv', 'data'=>$product_data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data', 'Authorization: Bearer '.$accessToken)); $result = curl_exec($ch); var_export(curl_error($ch)); var_export($result); curl_close($ch);
-
Thanks for the reply. I only changed the URL from the OwnCloud host to the new one. When I ran the terminal, it worked perfectly. I rebooted and tried from a private browser that doesn't keep the cache. When I did it from the terminal, I did it from port 80, and it worked